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_();
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,
Defines basic types widely shared across the project.
Iterator for all relevant cycles of the graph.
Definition: Cycles.h:65
std::unique_ptr< RdlCyclePtrs > cyclePtr_
Manage cycle data as shared pointer to permit expected iterator functionality.
Definition: Cycles.h:101
std::shared_ptr< RdlDataPtrs > rdlPtr_
Hold an owning reference to the base data to avoid dangling pointers.
Definition: Cycles.h:99
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
IteratorRange< UrfIdsCycleIterator > containing(const std::vector< BondIndex > &bonds) const
Range of relevant cycles containing several bonds.
unsigned numCycleFamilies(const BondIndex &bond) const
Returns the number of unique ring families (URFs) a bond is in.
unsigned numRelevantCycles(const BondIndex &bond) const
Returns the number of relevant cycles (RCs) a bond is in.
Cycles(const Graph &sourceGraph, bool ignoreEtaBonds=true)
Constructor from outer graph.
unsigned numCycleFamilies(AtomIndex index) const
Returns the number of unique ring families (URFs) an index is involved in.
unsigned numRelevantCycles(AtomIndex index) const
Returns the number of relevant cycles (RCs)
Cycles(const PrivateGraph &innerGraph, bool ignoreEtaBonds=true)
This is an overloaded member function, provided for convenience. It differs from the above function o...
IteratorRange< UrfIdsCycleIterator > containing(const BondIndex &bond) const
Range of relevant cycles containing a bond.
unsigned numCycleFamilies() const
Returns the number of unique ring families (URFs)
unsigned numRelevantCycles() const
Returns the number of relevant cycles (RCs)
IteratorRange< UrfIdsCycleIterator > containing(AtomIndex atom) const
Range of relevant cycles containing an atom.
RDL_data * dataPtr() const
Provide access to calculated data.
Represents the connectivity of atoms of a molecule.
Definition: Graph.h:54
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.
std::size_t AtomIndex
Unsigned integer atom index type. Used to refer to particular atoms.
Definition: Types.h:51
std::vector< AtomIndex > makeRingIndexSequence(std::vector< BondIndex > edgeDescriptors)
Create cycle vertex sequence from unordered edges.
boost::optional< unsigned > smallestCycleContaining(AtomIndex atom, const Cycles &cycles)
Yields the size of the smallest cycle containing an atom.
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.
unsigned countPlanarityEnforcingBonds(const std::vector< BondIndex > &edgeSet, const Graph &graph)
Count the number of planarity enforcing bonds.
Type used to refer to particular bonds. Orders first < second.
Definition: Types.h:54
Homogeneous pair of iterators with begin and end member fns.
Definition: IteratorRange.h:26