Molassembler  3.0.0
Molecule graph and conformer library
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Scine::Molassembler::GraphAlgorithms Namespace Reference

Core graph-level algorithms (not requiring stereopermutator information) More...

Data Structures

struct  EditDistanceForest
 Forest data structure to calculate exact graph edit distance with. More...
 

Functions

std::vector
< RankingInformation::Link
siteLinks (const PrivateGraph &graph, const AtomStereopermutator &stereopermutatorA, const AtomStereopermutator &stereopermutatorB)
 Find links between two adjacent stereopermutators, returns unordered links. More...
 
std::vector
< RankingInformation::Link
siteLinks (const PrivateGraph &graph, AtomIndex source, const std::vector< std::vector< AtomIndex > > &sites, const std::vector< AtomIndex > &excludeAdjacents)
 Find links between substituent atoms, returns ordered links. More...
 
std::vector< std::vector
< AtomIndex >> 
sites (const PrivateGraph &graph, AtomIndex placement, const std::vector< AtomIndex > &excludeAdjacents={})
 Differentiate adjacent vertices of a central index into sites. More...
 
void updateEtaBonds (PrivateGraph &graph)
 For each atom, determine sites and set eta bond for haptic sites. More...
 
std::vector< unsigned > distance (AtomIndex a, const PrivateGraph &graph)
 Calculates the graph distance from an atom to all other atoms of the molecule. More...
 
std::vector< AtomIndexshortestPaths (AtomIndex a, const PrivateGraph &graph)
 Generates the shortest paths to each vertex in the graph. More...
 
std::vector< AtomIndexbfsUniqueDescendants (AtomIndex source, const std::vector< AtomIndex > &descendants, const PrivateGraph &graph)
 Marks each vertex in the graph a unique descendant of a set of vertices adjacent to a starting vertex. More...
 

Detailed Description

Core graph-level algorithms (not requiring stereopermutator information)

Function Documentation

std::vector<AtomIndex> Scine::Molassembler::GraphAlgorithms::bfsUniqueDescendants ( AtomIndex  source,
const std::vector< AtomIndex > &  descendants,
const PrivateGraph &  graph 
)

Marks each vertex in the graph a unique descendant of a set of vertices adjacent to a starting vertex.

Parameters
sourceBFS source
descendantsVertices to classify each vertex a descendant of
graphGraph to visit
Returns
For each vertex in the graph, either:
  • the index of a descendant to signify unique descendance
  • the source vertex to signify belonging to none of the descendants
  • std::numeric_limits<AtomIndex>::max() to signify split ownership between descendants
std::vector<unsigned> Scine::Molassembler::GraphAlgorithms::distance ( AtomIndex  a,
const PrivateGraph &  graph 
)

Calculates the graph distance from an atom to all other atoms of the molecule.

Complexity \(\Theta(N)\)

Parameters
aThe atom from which to calculate distances
graphThe graph
Returns
A list of graph distances for each atom of the graph
std::vector<AtomIndex> Scine::Molassembler::GraphAlgorithms::shortestPaths ( AtomIndex  a,
const PrivateGraph &  graph 
)

Generates the shortest paths to each vertex in the graph.

Complexity \(\Theta(N)\)

Parameters
aSource vertex
graphThe graph
Returns
A flat predecessor map
std::vector<RankingInformation::Link> Scine::Molassembler::GraphAlgorithms::siteLinks ( const PrivateGraph &  graph,
const AtomStereopermutator &  stereopermutatorA,
const AtomStereopermutator &  stereopermutatorB 
)

Find links between two adjacent stereopermutators, returns unordered links.

Complexity \(\Theta(R)\) where \(R\) is the number of relevant cycles containing both stereopermutators' central indices

std::vector<RankingInformation::Link> Scine::Molassembler::GraphAlgorithms::siteLinks ( const PrivateGraph &  graph,
AtomIndex  source,
const std::vector< std::vector< AtomIndex > > &  sites,
const std::vector< AtomIndex > &  excludeAdjacents 
)

Find links between substituent atoms, returns ordered links.

Complexity \(O(S^2)\) where \(S\) is the number of substituents of the central vertex

std::vector< std::vector<AtomIndex>> Scine::Molassembler::GraphAlgorithms::sites ( const PrivateGraph &  graph,
AtomIndex  placement,
const std::vector< AtomIndex > &  excludeAdjacents = {} 
)

Differentiate adjacent vertices of a central index into sites.

A site is made up of all immediately group-internally-adjacent substituents of a central index. The reverse subdivision starting from a ligand may be more intuitive: A ligand may be multidentate and have varying hapticity at any shape position. It consists of bonding atoms (those connecting to the central metal) and non-bonding atoms (which may make up a linker or other extraneous groups). Bonding atoms can be subdivided into connected components that are separated by non-bonding atoms, each of which make up a possibly haptic group. These are called sites because they each take up a site of the central index's coordination shape.

Complexity \(\Theta(S)\) where \(S\) is the number of substituents of the central vertex

Postcondition
Each site's list of constituting atom indices is sorted.
void Scine::Molassembler::GraphAlgorithms::updateEtaBonds ( PrivateGraph &  graph)

For each atom, determine sites and set eta bond for haptic sites.

Cycle through all atoms, determine the sites and set the eta bond type for atoms constituting haptic ligand sites.

Complexity \(\Theta(N)\)