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

BGL wrapper to help with distance bounds smoothing. More...

#include <ExplicitBoundsGraph.h>

Public Types

Member types
using EdgeWeightProperty = boost::property< boost::edge_weight_t, double >
 
using GraphType = boost::adjacency_list< boost::vecS, boost::vecS, boost::directedS, boost::no_property, EdgeWeightProperty >
 
using VertexDescriptor = GraphType::vertex_descriptor
 
using EdgeDescriptor = GraphType::edge_descriptor
 
using BoundsMatrix = Eigen::MatrixXd
 

Public Member Functions

Special member functions
 ExplicitBoundsGraph (const PrivateGraph &inner, const DistanceBoundsMatrix &bounds)
 Construct from distance bounds matrix. More...
 
 ExplicitBoundsGraph (const PrivateGraph &inner, const BoundsMatrix &bounds)
 Construct from bounds matrix. More...
 
Modifiers
void addBound (VertexDescriptor a, VertexDescriptor b, const ValueBounds &bound)
 Adds a bound between outer vertex indices to the graph. More...
 
double lowerBound (VertexDescriptor a, VertexDescriptor b) const
 Fetches the lower bound between outer vertex indices from the graph. More...
 
double upperBound (VertexDescriptor a, VertexDescriptor b) const
 Fetches the upper bound between outer vertex indices from the graph. More...
 
Result< Eigen::MatrixXd > makeDistanceMatrix (Random::Engine &engine) noexcept
 Generate a distance matrix. More...
 
Result< Eigen::MatrixXd > makeDistanceMatrix (Random::Engine &engine, Partiality partiality) noexcept
 
Information
double maximalImplicitLowerBound (VertexDescriptor i) const
 Returns the length of the maximal implicit lower bound outgoing from a left vertex. More...
 
const GraphType & graph () const
 Nonmodifiable access to underlying graph. More...
 
Result< Eigen::MatrixXd > makeDistanceBounds () const noexcept
 Make smooth distance bounds. More...
 

Static Public Member Functions

Static member functions
static void explainContradictionPaths (VertexDescriptor a, VertexDescriptor b, const std::vector< VertexDescriptor > &predecessors, const std::vector< double > &distances)
 Explain contradictions between distance bounds on a path. More...
 
static bool isLeft (const VertexDescriptor i) noexcept
 Check whether a vertex is part of the left subgraph. More...
 
static bool sameSide (const VertexDescriptor i, const VertexDescriptor j) noexcept
 Explain contradictions between distance bounds on a path. More...
 
static VertexDescriptor left (const VertexDescriptor a) noexcept
 Get the left subgraph vertex descriptor corresponding to an outer index. More...
 
static VertexDescriptor right (const VertexDescriptor a) noexcept
 Get the right subgraph vertex descriptor corresponding to an outer index. More...
 

Private Member Functions

void updateOrAddEdge_ (VertexDescriptor i, VertexDescriptor j, double edgeWeight)
 
void updateGraphWithFixedDistance_ (VertexDescriptor a, VertexDescriptor b, double fixedDistance)
 

Private Attributes

GraphType graph_
 
const PrivateGraphinner_
 
std::array< Utils::ElementType, 2 > heaviestAtoms_
 Stores the two heaviest element types.
 

Detailed Description

BGL wrapper to help with distance bounds smoothing.

A class that helps with lower complexity determination of distance bounds compatible with the triangle inequality limits via reinterpretation as a graph shortest paths calculation.

The main idea is to transfer all ValueBounds collected by a SpatialModel to this class. The compatible triangle inequality bounds to this set of ValueBounds should then be extracted as a DistanceBoundsMatrix and kept for refinement. For every new conformation, the underlying graph containing the information from the ValueBounds needs to be copied and generateDistanceMatrix called upon it. This procedure modifies the underlying graph and hence cannot be called repeatedly.

The underlying data structure is a fully explicit BGL graph containing all edges and edge weights.

Constructor & Destructor Documentation

Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::ExplicitBoundsGraph ( const PrivateGraph inner,
const DistanceBoundsMatrix bounds 
)

Construct from distance bounds matrix.

Complexity \(\Theta(N^2)\)

Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::ExplicitBoundsGraph ( const PrivateGraph inner,
const BoundsMatrix &  bounds 
)

Construct from bounds matrix.

Complexity \(\Theta(N^2)\)

Member Function Documentation

void Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::addBound ( VertexDescriptor  a,
VertexDescriptor  b,
const ValueBounds bound 
)

Adds a bound between outer vertex indices to the graph.

This is represented by six edges:

  • Bidirectional within the left subgraph between a and b weighted with the upper bound
  • Bidirectional within the right subgraph between a and b weighted with the upper bound
  • Edges from the left vertices of a and b to the right opposite one with the negative lower bound

Complexity \(\Theta(1)\)

static void Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::explainContradictionPaths ( VertexDescriptor  a,
VertexDescriptor  b,
const std::vector< VertexDescriptor > &  predecessors,
const std::vector< double > &  distances 
)
static

Explain contradictions between distance bounds on a path.

Complexity linear in the length of the path between a and b

const GraphType& Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::graph ( ) const

Nonmodifiable access to underlying graph.

Complexity \(\Theta(1)\)

static bool Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::isLeft ( const VertexDescriptor  i)
inlinestaticnoexcept

Check whether a vertex is part of the left subgraph.

Complexity \(\Theta(1)\)

static VertexDescriptor Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::left ( const VertexDescriptor  a)
inlinestaticnoexcept

Get the left subgraph vertex descriptor corresponding to an outer index.

Complexity \(\Theta(1)\)

double Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::lowerBound ( VertexDescriptor  a,
VertexDescriptor  b 
) const

Fetches the lower bound between outer vertex indices from the graph.

Complexity \(\Theta(1)\)

Result<Eigen::MatrixXd> Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::makeDistanceBounds ( ) const
noexcept

Make smooth distance bounds.

Complexity \(\Theta(V \cdot E)\)

Result<Eigen::MatrixXd> Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::makeDistanceMatrix ( Random::Engine engine)
noexcept

Generate a distance matrix.

Generates a distances matrix conforming to the triangle inequality bounds while modifying state information. Can only be called once!

Complexity \(O(V^2 \cdot E)\)

Result<Eigen::MatrixXd> Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::makeDistanceMatrix ( Random::Engine engine,
Partiality  partiality 
)
noexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

double Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::maximalImplicitLowerBound ( VertexDescriptor  i) const

Returns the length of the maximal implicit lower bound outgoing from a left vertex.

Complexity \(\Theta(1)\)

static VertexDescriptor Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::right ( const VertexDescriptor  a)
inlinestaticnoexcept

Get the right subgraph vertex descriptor corresponding to an outer index.

Complexity \(\Theta(1)\)

static bool Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::sameSide ( const VertexDescriptor  i,
const VertexDescriptor  j 
)
inlinestaticnoexcept

Explain contradictions between distance bounds on a path.

Complexity linear in the length of the path between a and b

double Scine::Molassembler::DistanceGeometry::ExplicitBoundsGraph::upperBound ( VertexDescriptor  a,
VertexDescriptor  b 
) const

Fetches the upper bound between outer vertex indices from the graph.

Complexity \(\Theta(1)\)


The documentation for this class was generated from the following file: