11 #ifndef INCLUDE_MOLASSEMBLER_CYCLES_H
12 #define INCLUDE_MOLASSEMBLER_CYCLES_H
14 #include "boost/functional/hash.hpp"
15 #include "boost/optional/optional_fwd.hpp"
21 #include <unordered_map>
26 namespace Molassembler {
68 using iterator_category = std::forward_iterator_tag;
69 using difference_type = std::ptrdiff_t;
70 using value_type =
const std::vector<BondIndex>&;
71 using pointer =
const std::vector<BondIndex>*;
72 using reference = value_type;
76 const std::shared_ptr<RdlDataPtrs>& dataPtr,
77 unsigned rCycleIndex = 0
89 value_type operator * ()
const;
90 pointer operator -> ()
const;
107 using difference_type = unsigned;
108 using value_type =
const std::vector<BondIndex>&;
109 using pointer =
const std::vector<BondIndex>*;
110 using reference = value_type;
111 using iterator_category = std::forward_iterator_tag;
125 const std::shared_ptr<RdlDataPtrs>& dataPtr
130 std::vector<unsigned> urfs,
131 const std::shared_ptr<RdlDataPtrs>& dataPtr
135 const std::vector<BondIndex>& soughtBonds,
136 std::vector<unsigned> urfs,
137 const std::shared_ptr<RdlDataPtrs>& dataPtr
142 value_type operator * ()
const;
143 pointer operator -> ()
const;
153 std::shared_ptr<RdlDataPtrs> rdlPtr_;
154 std::unique_ptr<UrfHelper> urfsPtr_;
155 std::unique_ptr<RdlCyclePtrs> cyclePtr_;
157 void advanceToNextPermissibleCycle_();
158 void initializeCyclesFromUrfId_();
168 Cycles(
const Graph& sourceGraph,
bool ignoreEtaBonds =
true);
179 unsigned numCycleFamilies()
const;
186 unsigned numCycleFamilies(
AtomIndex index)
const;
193 unsigned numCycleFamilies(
const BondIndex& bond)
const;
199 unsigned numRelevantCycles()
const;
206 unsigned numRelevantCycles(
AtomIndex index)
const;
213 unsigned numRelevantCycles(
const BondIndex& bond)
const;
216 RDL_data* dataPtr()
const;
249 bool operator == (
const Cycles& other)
const;
250 bool operator != (
const Cycles& other)
const;
254 std::shared_ptr<RdlDataPtrs> rdlPtr_;
256 std::unordered_map<BondIndex, std::vector<unsigned>, boost::hash<BondIndex>> urfMap_;
288 std::vector<BondIndex> edgeDescriptors
296 std::vector<AtomIndex> ringIndexSequence,
308 const std::vector<BondIndex>& edgeSet,
std::unordered_map< AtomIndex, unsigned > makeSmallestCycleMap(const Cycles &cycleData)
Creates a mapping from atom index to the size of the smallest cycle containing that index...
Defines basic types widely shared across the project.
Represents the connectivity of atoms of a molecule.
Definition: Graph.h:54
Iterator for cycles of specific universal ring families.
Definition: Cycles.h:105
Wrapper class to make working with RDL in C++ more pleasant.
Definition: Cycles.h:44
Homogeneous pair of iterators with begin and end member fns.
Definition: IteratorRange.h:26
Iterator for all relevant cycles of the graph.
Definition: Cycles.h:65
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
Library internal graph class wrapping BGL types.
Definition: PrivateGraph.h:26
std::vector< AtomIndex > centralizeRingIndexSequence(std::vector< AtomIndex > ringIndexSequence, AtomIndex center)
Centralize a cycle vertex sequence at a particular vertex.
Type used to refer to particular bonds. Orders first < second.
Definition: Types.h:54
std::shared_ptr< RdlDataPtrs > rdlPtr_
Hold an owning reference to the base data to avoid dangling pointers.
Definition: Cycles.h:99
unsigned countPlanarityEnforcingBonds(const std::vector< BondIndex > &edgeSet, const Graph &graph)
Count the number of planarity enforcing bonds.
boost::optional< unsigned > smallestCycleContaining(AtomIndex atom, const Cycles &cycles)
Yields the size of the smallest cycle containing an atom.
std::unique_ptr< RdlCyclePtrs > cyclePtr_
Manage cycle data as shared pointer to permit expected iterator functionality.
Definition: Cycles.h:101
std::vector< AtomIndex > makeRingIndexSequence(std::vector< BondIndex > edgeDescriptors)
Create cycle vertex sequence from unordered edges.