1 //
2 //  Copyright (C) 2005-2006 Rational Discovery LLC
3 //
4 //   @@ All Rights Reserved @@
5 //  This file is part of the RDKit.
6 //  The contents are covered by the terms of the BSD license
7 //  which is included in the file license.txt, found at the root
8 //  of the RDKit source tree.
9 //
10 
11 #include <RDGeneral/export.h>
12 #ifndef _RD_FEATTREE_H_
13 #define _RD_FEATTREE_H_
14 
15 #include <boost/graph/adjacency_list.hpp>
16 #include <boost/property_map.hpp>
17 #include <boost/shared_ptr.hpp>
18 #include <set>
19 
20 namespace RDKit {
21 class ROMol;
22 
23 namespace FeatTrees {
24 typedef std::set<unsigned int> UINT_SET;
25 
26 // Each node of the feature tree topology contains:
27 //   - a record of the atom indices that are lumped into
28 //     that node
29 struct FeatTreeNode_t {
30   enum { num = 1027 };
31   typedef boost::vertex_property_tag kind;
32 };
33 typedef boost::property<FeatTreeNode_t, UINT_SET> FeatTreeNode;
34 
35 // Each edge of the feature tree topology contains:
36 //   - an indicator of the number of rings at the ends
37 //     (0, 1, or 2)
38 struct FeatTreeEdge_t {
39   enum { num = 1028 };
40   typedef boost::edge_property_tag kind;
41 };
42 typedef boost::property<FeatTreeEdge_t, unsigned int> FeatTreeEdge;
43 
44 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
45                               FeatTreeNode, FeatTreeEdge>
46     FeatTreeGraph;
47 typedef boost::shared_ptr<FeatTreeGraph> FeatTreeGraphSPtr;
48 
49 typedef boost::property_map<FeatTreeGraph, FeatTreeEdge_t>::type
50     FeatTreeEdgePMap;
51 typedef boost::property_map<FeatTreeGraph, FeatTreeNode_t>::type
52     FeatTreeNodePMap;
53 
54 /*!
55 
56 */
57 FeatTreeGraphSPtr molToBaseTree(const ROMol &mol);
58 
59 void baseTreeToFeatTree(FeatTreeGraph &baseTree);
60 }  // namespace FeatTrees
61 }  // namespace RDKit
62 #endif
63