RDKit
Open-source cheminformatics and machine learning.
Graph.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2014 Novartis Institutes for BioMedical Research
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 // graph topology in terms of indeces in source molecule
12 #include <RDGeneral/export.h>
13 #pragma once
14 #include <boost/graph/adjacency_list.hpp>
15 
16 namespace RDKit {
17 namespace FMCS {
18 typedef unsigned AtomIdx_t;
19 typedef unsigned BondIdx_t;
20 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
21  AtomIdx_t, BondIdx_t> Graph_t;
22 
23 class RDKIT_FMCS_EXPORT Graph : public Graph_t {
24  public:
25  typedef edge_iterator EDGE_ITER;
26  typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
27 
28  void addAtom(unsigned atom) {
29  Graph::vertex_descriptor which = boost::add_vertex(*this);
30  (*this)[which] = atom;
31  }
32  void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom) {
33  bool res;
34  Graph_t::edge_descriptor which;
35  boost::tie(which, res) = boost::add_edge(beginAtom, endAtom, *this);
36  (*this)[which] = bond;
37  }
38 };
39 }
40 }
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, AtomIdx_t, BondIdx_t > Graph_t
Definition: Graph.h:21
void addAtom(unsigned atom)
Definition: Graph.h:28
#define RDKIT_FMCS_EXPORT
Definition: export.h:190
void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom)
Definition: Graph.h:32
unsigned AtomIdx_t
Definition: Graph.h:18
Std stuff.
Definition: Atom.h:30
unsigned BondIdx_t
Definition: Graph.h:19
std::pair< EDGE_ITER, EDGE_ITER > BOND_ITER_PAIR
Definition: Graph.h:26
edge_iterator EDGE_ITER
Definition: Graph.h:25