2 #ifndef INDIGOX_GRAPH_ASSIGNMENT_HPP 3 #define INDIGOX_GRAPH_ASSIGNMENT_HPP 4 #include "../utils/common.hpp" 5 #include "../utils/fwd_declares.hpp" 8 #include <EASTL/vector_map.h> 19 class IXAGVertex :
public std::enable_shared_from_this<IXAGVertex> {
30 : _source_vert(v), _source_edge(), _pre(0), _count(0) {}
37 : _source_vert(), _source_edge(e), _pre(2), _count(0) {}
46 inline bool IsEdgeMapped()
const {
return !_source_edge.expired(); }
90 _MGVertex _source_vert;
97 uint32_t _pre, _count;
110 using graph_type = IXGraphBase<IXAGVertex, std::nullptr_t>;
112 using VertContain = std::vector<AGVertex>;
132 return _g.HasVertex(v.get());
139 return _v2v.find(v) != _v2v.end();
146 return _e2v.find(e) != _e2v.end();
177 : std::numeric_limits<size_t>::max();
185 inline std::pair<NbrsIter, NbrsIter>
187 return HasVertex(v) ? std::make_pair(_n.at(v).begin(), _n.at(v).end())
188 : std::make_pair(_v.end(), _v.end());
194 return {_v.begin(), _v.end()};
227 void DetermineAllNeighbours();
231 _MolecularGraph _source;
235 eastl::vector_map<MGVertex, AGVertex> _v2v;
237 eastl::vector_map<MGEdge, AGVertex> _e2v;
241 std::map<AGVertex, VertContain> _n;
void SetPreAssignedCount(const uint32_t count)
Set the number of pre-assigned eletrons.
Definition: assignment.hpp:71
void PreassignElectrons()
Check if the graph is connected.
IXAssignmentGraph()=delete
MGEdge GetSourceEdge() const
Obtain the referenced IXMolecularGraph edge.
Definition: assignment.hpp:60
Definition: assignment.hpp:16
friend struct indigox::test::TestAssignmentGraph
Friendship allows IXAssignmentGraph to be properly tested.
Definition: assignment.hpp:107
Class used to assign electrons to a molecule.
Definition: assignment.hpp:105
void SetAssignedCount(const uint32_t count)
Set the number of assigned eletrons.
Definition: assignment.hpp:86
Class for the edges of a IXMolecularGraph.
Definition: molecular.hpp:55
Class containing a graph representation of a molecule.
Definition: molecular.hpp:95
std::pair< NbrsIter, NbrsIter > GetNeighbours(const AGVertex &v) const
Get the neighbours of a vertex.
Definition: assignment.hpp:186
VertContain::const_iterator NbrsIter
Type of the iterator returned by the GetNeihbours() method.
Definition: assignment.hpp:118
size_t NumVertices() const
Get the number of vertices in the graph.
Definition: assignment.hpp:169
bool IsVertexMapped() const
Is the associated IXMolecularGraph member a vertex.
Definition: assignment.hpp:42
Class for the vertices of a IXMolecularGraph.
Definition: molecular.hpp:20
MGVertex GetSourceVertex() const
Obtain the referenced IXMolecularGraph vertex.
Definition: assignment.hpp:52
uint32_t GetPreAssignedCount() const
Get the number of pre-assigned electrons.
Definition: assignment.hpp:66
uint32_t GetAssignedCount() const
Get the number of assigned electrons.
Definition: assignment.hpp:76
std::shared_ptr< IXAGVertex > AGVertex
Definition: fwd_declares.hpp:104
VertContain::const_iterator VertIter
Type of the iterator returned by the GetVertices() method.
Definition: assignment.hpp:116
bool HasVertex(const MGEdge &e) const
Check if an IXMGEdge has an associated vertex in this graph.
Definition: assignment.hpp:145
size_t Degree(const AGVertex &v) const
Get the degree of a vertex.
Definition: assignment.hpp:175
AGVertex GetVertex(const MGVertex &v) const
Get the AGVertex associated with an MGVertex.
Definition: assignment.hpp:154
uint32_t GetTotalAssigned() const
Get the total number of assigned electrons.
Definition: assignment.hpp:82
Class for the vertices of an IXAssignmentGraph.
Definition: assignment.hpp:19
bool HasVertex(const AGVertex &v) const
Check if an IXAGVertex belongs to this graph.
Definition: assignment.hpp:131
bool IsEdgeMapped() const
Is the associated IXMoleculerGraph member an edge.
Definition: assignment.hpp:46
AGVertex GetVertex(const MGEdge &e) const
Get the AGVertex associated with an MGEdge.
Definition: assignment.hpp:163
std::pair< VertIter, VertIter > GetVertices() const
Get the vertices of the graph.
Definition: assignment.hpp:193
bool HasVertex(const MGVertex &v) const
Check if an IXMGVertex has an associated vertex in this graph.
Definition: assignment.hpp:138