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 () final | |
Constructors | |
| Graph () | |
| Wrapping constructor. | |
| Graph (PrivateGraph &&inner) | |
| Wrapping constructor. | |
Modification | |
| AtomIndex | addAtom (Utils::ElementType e, AtomIndex i, BondType type) final |
| BondIndex | addBond (AtomIndex i, AtomIndex j, BondType type) final |
| void | setElementType (AtomIndex i, Utils::ElementType type) final |
| bool | setBondType (AtomIndex i, AtomIndex j, BondType type) final |
| void | removeAtom (AtomIndex i) final |
| void | removeBond (const BondIndex &bond) final |
Information | |
| bool | adjacent (AtomIndex a, AtomIndex b) const final |
| 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 final |
| 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 final |
| Fetch the bond type at a particular bond. More... | |
| bool | canRemove (AtomIndex a) const final |
| Returns whether an atom can be removed without disconnecting the graph. More... | |
| bool | canRemove (const BondIndex &edge) const final |
| Returns whether a bond can be removed without disconnecting the graph. More... | |
| const Cycles & | cycles () const final |
| Fetch a reference to Cycles. More... | |
| unsigned | degree (AtomIndex a) const final |
| 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 final |
| Fetch the element type of an atom. More... | |
| AtomIndex | N () const |
| Number of atoms in the graph. More... | |
| AtomIndex | V () const final |
| Number of atoms in the graph. More... | |
| unsigned | B () const |
| Number of bonds in the graph. More... | |
| unsigned | E () const final |
| 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... | |
Modification | |
Information | |
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)\)
Implements Scine::Molassembler::GraphInterface.
| 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(V)\)
| IteratorRange<AtomIterator> Scine::Molassembler::Graph::atoms | ( | ) | const |
A begin-end pair of iterators that yield the range of valid atom indices.
Complexity \(\Theta(V)\)
| std::vector<AtomIndex> Scine::Molassembler::Graph::atomsOfElement | ( | Utils::ElementType | e | ) | const |
Returns atoms matching an element type.
Complexity \(\Theta(V)\)
| unsigned Scine::Molassembler::Graph::B | ( | ) | const |
Number of bonds in the graph.
Complexity \(\Theta(1)\)
|
finalvirtual |
Optionally fetch the bond index of a possibly non-existent bond.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
| Utils::BondOrderCollection Scine::Molassembler::Graph::bondOrders | ( | ) | const |
Generate a BondOrderCollection from the graph.
Complexity \(\Theta(E)\)
| IteratorRange<BondIterator> Scine::Molassembler::Graph::bonds | ( | ) | const |
A begin-end pair of iterators that yield the range of valid bond indices.
Complexity \(\Theta(V)\)
| 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(V)\)
Fetch the bond type at a particular bond.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
|
finalvirtual |
Returns whether an atom can be removed without disconnecting the graph.
Complexity \(O(V)\) worst case, if removal data is cached \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
|
finalvirtual |
Returns whether a bond can be removed without disconnecting the graph.
Complexity \(O(V)\) worst case, if removal data is cached \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
|
finalvirtual |
Fetch a reference to Cycles.
Complexity \(O(E)\) worst case where \(B\) is the number of bonds in cycles, if cycles are cached \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
|
finalvirtual |
Returns the number of bonds incident upon an atom.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
|
finalvirtual |
Number of bonds in the graph.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
| Utils::ElementTypeCollection Scine::Molassembler::Graph::elementCollection | ( | ) | const |
Fetch an element collection of all atoms.
Complexity \(\Theta(V)\)
|
finalvirtual |
Fetch the element type of an atom.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.
| 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(V)\)
The atoms making up the bond are in the resulting atom lists, too.
|
finalvirtual |
Number of atoms in the graph.
Complexity \(\Theta(1)\)
Implements Scine::Molassembler::GraphInterface.