8 #ifndef INCLUDE_MOLASSEMBLER_INNER_GRAPH_H
9 #define INCLUDE_MOLASSEMBLER_INNER_GRAPH_H
11 #include "boost/graph/adjacency_list.hpp"
21 namespace Molassembler {
32 Utils::ElementType elementType;
44 using BglType = boost::adjacency_list<
70 using Vertex = BglType::vertex_descriptor;
71 using Edge = BglType::edge_descriptor;
158 Utils::ElementType& elementType(
Vertex a);
185 const std::vector<Vertex>& copyVertices = {}
271 [[deprecated(
"Prefer V")]]
274 [[deprecated(
"Prefer E")]]
304 std::vector<AtomIndex>,
305 std::vector<AtomIndex>
310 std::vector<AtomIndex>,
311 std::vector<AtomIndex>
346 return !(*
this == other);
354 boost::optional<RemovalSafetyData> removalSafetyDataOption;
355 boost::optional<Cycles> cyclesOption;
356 boost::optional<Cycles> etaPreservedCyclesOption;
358 inline void invalidate() {
359 removalSafetyDataOption = boost::none;
360 cyclesOption = boost::none;
361 etaPreservedCyclesOption = boost::none;
366 Cycles generateCycles_()
const;
367 Cycles generateEtaPreservedCycles_()
const;
Definition: PrivateGraph.h:353
boost::adjacency_list< boost::vecS, boost::vecS, boost::undirectedS, VertexData, EdgeData > BglType
Definition: PrivateGraph.h:68
Vertex V() const
Number of vertices in the graph.
std::unordered_set< PrivateGraph::Vertex > articulationVertices
Articulation vertices cannot be removed without disconnecting the graph.
Definition: PrivateGraph.h:87
std::unordered_map< Vertex, Vertex > merge(const PrivateGraph &other, const std::vector< Vertex > ©Vertices={})
Copy a vertices and edges into another graph.
const Cycles & cycles() const
Access cycle information of the graph.
std::set< PrivateGraph::Edge > bridges
Bridges are edges that cannot be removed without disconnecting the graph.
Definition: PrivateGraph.h:89
Information stored at each graph vertex.
Definition: PrivateGraph.h:31
BglType & bgl()
Referential access to the underlying BGL graph.
const Cycles & etaPreservedCycles() const
Access cycle information of the graph with eta bonds preserved.
bool operator==(const PrivateGraph &other) const
Full isomorphism comparison including element types and bond orders.
Class to explore cyclic structure of molecules.
unsigned E() const
Number of edges in the graph.
Edge edge(Vertex a, Vertex b) const
Make an edge descriptor from two vertex descriptors.
Vertex N() const
Number of vertices in the graph.
AtomEnvironmentComponents
For bitmasks grouping components of immediate atom environments.
Definition: Types.h:103
const RemovalSafetyData & removalSafetyData() const
Access removal safety information of the graph.
Data class to return removal safety information on the graph.
Definition: PrivateGraph.h:85
Wrapper class to make working with RDL in C++ more pleasant.
Definition: Cycles.h:44
void applyPermutation(const std::vector< Vertex > &permutation)
Apply a permutation to the graph.
unsigned connectedComponents() const
Number of connected components.
Information stored at each graph edge.
Definition: PrivateGraph.h:36
Homogeneous pair of iterators with begin and end member fns.
Definition: IteratorRange.h:26
void removeEdge(const Edge &e)
Removes an edge from the graph.
PrivateGraph()
Empty constructor.
std::pair< std::vector< AtomIndex >, std::vector< AtomIndex > > splitAlongBridge(Edge bridge) const
Determine which vertices belong to which side of a bridge edge.
BglType graph_
A directly owned Boost Library Graph.
Definition: PrivateGraph.h:373
std::string graphviz() const
Returns whether two vertices are adjacent.
void populateProperties() const
Access cycle information of the graph.
Vertex target(const Edge &edge) const
Target of an edge.
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
boost::optional< Edge > edgeOption(Vertex a, Vertex b) const
Get an edge descriptor from two vertex descriptors, get None if the edge doesn't exist.
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
IteratorRange< BglType::adjacency_iterator > AdjacentVertexRange
Definition: PrivateGraph.h:75
bool canRemove(Vertex a) const
Determine whether a vertex can be safely removed.
BondType & bondType(const Edge &edge)
Fetch the bond type of an edge.
BondType
Discrete bond type numeration.
Definition: Types.h:26
BglType::edge_descriptor Edge
Definition: PrivateGraph.h:71
IteratorRange< BglType::out_edge_iterator > IncidentEdgeRange
Definition: PrivateGraph.h:76
Properties properties_
Property caching.
Definition: PrivateGraph.h:375
IteratorRange< BglType::edge_iterator > EdgeRange
Definition: PrivateGraph.h:74
unsigned degree(Vertex a) const
Number of substituents of a vertex.
static constexpr Vertex removalPlaceholder
Placeholder vertex index used to indicate that a vertex has been removed.
Definition: PrivateGraph.h:113
bool adjacent(Vertex a, Vertex b) const
Returns whether two vertices are adjacent.
Edge addEdge(Vertex a, Vertex b, BondType bondType)
Add an edge to the graph.
void removeVertex(Vertex a)
Removes a vertex from the graph.
Utils::ElementType & elementType(Vertex a)
Fetches the element type of a vertex.
bool identicalGraph(const PrivateGraph &other) const
Checks whether all edges present in *this are present in other.
IteratorRange< BglType::vertex_iterator > VertexRange
Definition: PrivateGraph.h:73
boost::optional< std::vector< AtomIndex > > modularIsomorphism(const PrivateGraph &other, AtomEnvironmentComponents components=AtomEnvironmentComponents::All) const
Modular isomorphism comparison.
BglType::vertex_descriptor Vertex
Definition: PrivateGraph.h:70
Vertex source(const Edge &edge) const
Source of an edge.
Vertex B() const
Number of edges in the graph.
Utils::ElementTypeCollection elementCollection() const
Returns whether two vertices are adjacent.
void clearVertex(Vertex a)
Removes all bonds involving a vertex.
bool operator!=(const PrivateGraph &other) const
Full isomorphism comparison including element types and bond orders.
Definition: PrivateGraph.h:345
Vertex addVertex(Utils::ElementType elementType)
Add a (disconnected) vertex to the graph.