RDKit: Graph.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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 indices in source molecule
12#include <RDGeneral/export.h>
13#pragma once
14#include <RDGeneral/BoostStartInclude.h>
15#include <boost/graph/adjacency_list.hpp>
16#include <RDGeneral/BoostEndInclude.h>
17
18namespace RDKit {
19namespace FMCS {
20 typedef unsigned int AtomIdx_t;
21 typedef unsigned int BondIdx_t;
22typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS,
23 AtomIdx_t, BondIdx_t>
24 Graph_t;
25
26 class RDKIT_FMCS_EXPORT Graph : public Graph_t {
27 public:
28 typedef edge_iterator EDGE_ITER;
29 typedef std::pair<EDGE_ITER, EDGE_ITER> BOND_ITER_PAIR;
30
31 void addAtom(unsigned int atom) {
32 Graph::vertex_descriptor which = boost::add_vertex(*this);
33 (*this)[which] = atom;
34 }
35 void addBond(unsigned int bond, unsigned int beginAtom,
36 unsigned int endAtom) {
37 bool res;
38 Graph_t::edge_descriptor which;
39 boost::tie(which, res) = boost::add_edge(beginAtom, endAtom, *this);
40 (*this)[which] = bond;
41 }
42};
43} // namespace FMCS
44} // namespace RDKit
BoostEndInclude.h
BoostStartInclude.h
RDKit::FMCS::Graph
Definition Graph.h:26
RDKit::FMCS::Graph::addBond
void addBond(unsigned int bond, unsigned int beginAtom, unsigned int endAtom)
Definition Graph.h:35
RDKit::FMCS::Graph::EDGE_ITER
edge_iterator EDGE_ITER
Definition Graph.h:28
RDKit::FMCS::Graph::addAtom
void addAtom(unsigned int atom)
Definition Graph.h:31
RDKit::FMCS::Graph::BOND_ITER_PAIR
std::pair< EDGE_ITER, EDGE_ITER > BOND_ITER_PAIR
Definition Graph.h:29
export.h
RDKIT_FMCS_EXPORT
#define RDKIT_FMCS_EXPORT
Definition export.h:169
RDKit::FMCS
Definition Composition2N.h:13
RDKit::FMCS::Graph_t
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, AtomIdx_t, BondIdx_t > Graph_t
Definition Graph.h:24
RDKit::FMCS::AtomIdx_t
unsigned int AtomIdx_t
Definition Graph.h:20
RDKit::FMCS::BondIdx_t
unsigned int BondIdx_t
Definition Graph.h:21
RDKit
Std stuff.
Definition Abbreviations.h:19