RDKit: Graph.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 #pragma once
13 #include <boost/graph/adjacency_list.hpp>
14
15 namespace RDKit {
16 namespace FMCS {
17 typedef unsigned AtomIdx_t;
18 typedef unsigned BondIdx_t;
19 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
20 AtomIdx_t, BondIdx_t> Graph_t;
21
22 class Graph : public Graph_t {
23 public:
24 typedef edge_iterator EDGE_ITER;
25 typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
26
27 void addAtom(unsigned atom) {
28 Graph::vertex_descriptor which = boost::add_vertex(*this);
29 (*this)[which] = atom;
30 }
31 void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom) {
32 bool res;
33 Graph_t::edge_descriptor which;
34 boost::tie(which, res) = boost::add_edge(beginAtom, endAtom, *this);
35 (*this)[which] = bond;
36 }
37 };
38 }
39 }
RDKit::FMCS::Graph_t
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, AtomIdx_t, BondIdx_t > Graph_t
Definition: Graph.h:20
RDKit::FMCS::Graph::addAtom
void addAtom(unsigned atom)
Definition: Graph.h:27
RDKit::FMCS::Graph::addBond
void addBond(unsigned bond, unsigned beginAtom, unsigned endAtom)
Definition: Graph.h:31
RDKit::FMCS::AtomIdx_t
unsigned AtomIdx_t
Definition: Graph.h:17
RDKit::FMCS::Graph
Definition: Graph.h:22
RDKit
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
RDKit::FMCS::BondIdx_t
unsigned BondIdx_t
Definition: Graph.h:18
RDKit::FMCS::Graph::BOND_ITER_PAIR
std::pair< EDGE_ITER, EDGE_ITER > BOND_ITER_PAIR
Definition: Graph.h:25
RDKit::FMCS::Graph::EDGE_ITER
edge_iterator EDGE_ITER
Definition: Graph.h:24