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,
23 
25  public:
26  typedef edge_iterator EDGE_ITER;
27  typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
28 
29  void addAtom(unsigned atom) {
30  Graph::vertex_descriptor which = boost::add_vertex(*this);
31  (*this)[which] = atom;
32  }
33  void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom) {
34  bool res;
35  Graph_t::edge_descriptor which;
36  boost::tie(which, res) = boost::add_edge(beginAtom, endAtom, *this);
37  (*this)[which] = bond;
38  }
39 };
40 } // namespace FMCS
41 } // namespace RDKit
RDKit::FMCS::Graph::BOND_ITER_PAIR
std::pair< EDGE_ITER, EDGE_ITER > BOND_ITER_PAIR
Definition: Graph.h:27
RDKit::FMCS::BondIdx_t
unsigned BondIdx_t
Definition: Graph.h:19
RDKit::FMCS::Graph::EDGE_ITER
edge_iterator EDGE_ITER
Definition: Graph.h:26
RDKit::FMCS::AtomIdx_t
unsigned AtomIdx_t
Definition: Graph.h:18
RDKit::FMCS::Graph::addBond
void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom)
Definition: Graph.h:33
RDKit
Std stuff.
Definition: Atom.h:30
RDKIT_FMCS_EXPORT
#define RDKIT_FMCS_EXPORT
Definition: export.h:203
RDKit::FMCS::Graph::addAtom
void addAtom(unsigned atom)
Definition: Graph.h:29
RDKit::FMCS::Graph
Definition: Graph.h:24
RDKit::FMCS::Graph_t
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, AtomIdx_t, BondIdx_t > Graph_t
Definition: Graph.h:22
export.h