Represents the connectivity of atoms of a molecule. More...
#include <Graph.h>
Data Structures | |
class | InnerBasedIterator |
Templated iterator facade based on PrivateGraph to provide iterative access to atom indices and edge indices. More... | |
Public Types | |
Member types | |
using | AtomIterator = InnerBasedIterator< AtomIndex, false > |
Iterator type yielding all valid atom indices. | |
using | BondIterator = InnerBasedIterator< BondIndex, false > |
Iterator type yielding all valid bond indices. | |
using | AdjacencyIterator = InnerBasedIterator< AtomIndex, true > |
Iterator type yielding adjacent atoms to an atom. | |
using | IncidentEdgesIterator = InnerBasedIterator< BondIndex, true > |
Iterator type yielding incident bonds to an atom. | |
Public Member Functions | |
PrivateGraph & | inner () |
Access to library-internal graph representation class. More... | |
const PrivateGraph & | inner () const |
Const-access to library-internal graph representation class. More... | |
Special member functions | |
Graph (Graph &&other) noexcept | |
Graph & | operator= (Graph &&other) noexcept |
Graph (const Graph &other) | |
Graph & | operator= (const Graph &other) |
~Graph () | |
Constructors | |
Graph () | |
Wrapping constructor. | |
Graph (PrivateGraph &&inner) | |
Wrapping constructor. | |
Information | |
bool | adjacent (AtomIndex a, AtomIndex b) const |
Returns whether two atoms are bonded. More... | |
std::vector< AtomIndex > | atomsOfElement (Utils::ElementType e) const |
Returns atoms matching an element type. More... | |
boost::optional< BondIndex > | bond (AtomIndex a, AtomIndex b) const |
Optionally fetch the bond index of a possibly non-existent bond. More... | |
Utils::BondOrderCollection | bondOrders () const |
Generate a BondOrderCollection from the graph. More... | |
BondType | bondType (const BondIndex &edge) const |
Fetch the bond type at a particular bond. More... | |
bool | canRemove (AtomIndex a) const |
Returns whether an atom can be removed without disconnecting the graph. More... | |
bool | canRemove (const BondIndex &edge) const |
Returns whether a bond can be removed without disconnecting the graph. More... | |
const Cycles & | cycles () const |
Fetch a reference to Cycles. More... | |
unsigned | degree (AtomIndex a) const |
Returns the number of bonds incident upon an atom. More... | |
std::string | dumpGraphviz () const |
Dumps a graphviz representation of the graph. | |
Utils::ElementTypeCollection | elementCollection () const |
Fetch an element collection of all atoms. More... | |
Utils::ElementType | elementType (AtomIndex a) const |
Fetch the element type of an atom. More... | |
AtomIndex | N () const |
Number of atoms in the graph. More... | |
unsigned | B () const |
Number of bonds in the graph. More... | |
boost::optional< std::vector < AtomIndex > > | modularIsomorphism (const Graph &other, AtomEnvironmentComponents components=AtomEnvironmentComponents::All) const |
Modular isomorphism comparison. More... | |
std::pair< std::vector < AtomIndex >, std::vector < AtomIndex > > | splitAlongBridge (BondIndex bridge) const |
Determine which vertices belong to which side of a bridge edge. More... | |
Operators | |
bool | operator== (const Graph &other) const |
Full isomorphism comparison including element types and bond orders. | |
bool | operator!= (const Graph &other) const |
Full isomorphism comparison including element types and bond orders. | |
Ranges | |
IteratorRange< AtomIterator > | atoms () const |
A begin-end pair of iterators that yield the range of valid atom indices. More... | |
IteratorRange< BondIterator > | bonds () const |
A begin-end pair of iterators that yield the range of valid bond indices. More... | |
IteratorRange< AdjacencyIterator > | adjacents (AtomIndex a) const |
Fetch iterator pair yielding adjacents of an atom. More... | |
IteratorRange < IncidentEdgesIterator > | bonds (AtomIndex a) const |
Fetch iterator pair yielding bonds indices indicent to an atom. More... | |
Private Attributes | |
std::unique_ptr< PrivateGraph > | innerPtr_ |
Represents the connectivity of atoms of a molecule.
An undirected graph consisting of atom vertices and bond edges. Vertices store the atomic element type while vertices store a bond type that distinguishes the bond orders one through six as well as a so-called eta bond, which models connections between a central atom and a haptically-bonded subset of atoms (i.e. a contiguous group of atoms all bonded to a transition metal).
The Graph class leaves a consumer a lot of freedom in the specification of the molecule's graph, but does enforce some model limitations.
Returns whether two atoms are bonded.
Complexity \(\Theta(1)\)
IteratorRange<AdjacencyIterator> Scine::Molassembler::Graph::adjacents | ( | AtomIndex | a | ) | const |
Fetch iterator pair yielding adjacents of an atom.
a | The atom whose adjacents are desired |
Complexity \(\Theta(N)\)
IteratorRange<AtomIterator> Scine::Molassembler::Graph::atoms | ( | ) | const |
A begin-end pair of iterators that yield the range of valid atom indices.
Complexity \(\Theta(N)\)
std::vector<AtomIndex> Scine::Molassembler::Graph::atomsOfElement | ( | Utils::ElementType | e | ) | const |
Returns atoms matching an element type.
Complexity \(\Theta(N)\)
unsigned Scine::Molassembler::Graph::B | ( | ) | const |
Number of bonds in the graph.
Complexity \(\Theta(1)\)
Optionally fetch the bond index of a possibly non-existent bond.
Complexity \(\Theta(1)\)
Utils::BondOrderCollection Scine::Molassembler::Graph::bondOrders | ( | ) | const |
Generate a BondOrderCollection from the graph.
Complexity \(\Theta(B)\)
IteratorRange<BondIterator> Scine::Molassembler::Graph::bonds | ( | ) | const |
A begin-end pair of iterators that yield the range of valid bond indices.
Complexity \(\Theta(N)\)
IteratorRange<IncidentEdgesIterator> Scine::Molassembler::Graph::bonds | ( | AtomIndex | a | ) | const |
Fetch iterator pair yielding bonds indices indicent to an atom.
a | The atom whose incident atoms are desired |
Complexity \(\Theta(N)\)
Fetch the bond type at a particular bond.
Complexity \(\Theta(1)\)
bool Scine::Molassembler::Graph::canRemove | ( | AtomIndex | a | ) | const |
Returns whether an atom can be removed without disconnecting the graph.
Complexity \(O(N)\) worst case, if removal data is cached \(\Theta(1)\)
bool Scine::Molassembler::Graph::canRemove | ( | const BondIndex & | edge | ) | const |
Returns whether a bond can be removed without disconnecting the graph.
Complexity \(O(N)\) worst case, if removal data is cached \(\Theta(1)\)
const Cycles& Scine::Molassembler::Graph::cycles | ( | ) | const |
Fetch a reference to Cycles.
Complexity \(O(B)\) worst case where \(B\) is the number of bonds in cycles, if cycles are cached \(\Theta(1)\)
unsigned Scine::Molassembler::Graph::degree | ( | AtomIndex | a | ) | const |
Returns the number of bonds incident upon an atom.
Complexity \(\Theta(1)\)
Utils::ElementTypeCollection Scine::Molassembler::Graph::elementCollection | ( | ) | const |
Fetch an element collection of all atoms.
Complexity \(\Theta(N)\)
Utils::ElementType Scine::Molassembler::Graph::elementType | ( | AtomIndex | a | ) | const |
Fetch the element type of an atom.
Complexity \(\Theta(1)\)
PrivateGraph& Scine::Molassembler::Graph::inner | ( | ) |
Access to library-internal graph representation class.
Complexity \(\Theta(1)\)
const PrivateGraph& Scine::Molassembler::Graph::inner | ( | ) | const |
Const-access to library-internal graph representation class.
Complexity \(\Theta(1)\)
boost::optional<std::vector<AtomIndex> > Scine::Molassembler::Graph::modularIsomorphism | ( | const Graph & | other, |
AtomEnvironmentComponents | components = AtomEnvironmentComponents::All |
||
) | const |
Modular isomorphism comparison.
Returns None if the molecules are not isomorphic. Returns an index mapping from this to other otherwise.
AtomIndex Scine::Molassembler::Graph::N | ( | ) | const |
Number of atoms in the graph.
Complexity \(\Theta(1)\)
std::pair< std::vector<AtomIndex>, std::vector<AtomIndex> > Scine::Molassembler::Graph::splitAlongBridge | ( | BondIndex | bridge | ) | const |
Determine which vertices belong to which side of a bridge edge.
Complexity \(\Theta(N)\)
The atoms making up the bond are in the resulting atom lists, too.