9 #ifndef GlobeEngine_Graph_h
10 #define GlobeEngine_Graph_h
13 #include "OpenGL_Includes.h"
22 template <
class NODETYPE,
class EDGETYPE,
class U>
class Graph
36 unsigned int idx =
nodes.size();
38 std::pair< NODETYPE, U> pairContent(_node, idx);
40 std::pair< U, NODETYPE> pairID( idx, _node);
50 return this->
nodes.size();
54 typename std::map< NODETYPE, U >::const_iterator nodeByContentItr =
nodeByContent.find(_content);
56 return nodeByContentItr->second;
63 typename std::map< U, NODETYPE >::const_iterator nodeByIDItr =
nodeByID.find(_id);
65 return nodeByIDItr->second;
77 for (
int i = 0;i <
nodes.size();i++) {
78 if (
nodes[i].isEndpoint()) {
79 ids.push_back(
nodes[i].getUID());
87 for (
int i = 0;i <
nodes.size();i++) {
88 if (
nodes[i].isCrossing()) {
89 ids.push_back(
nodes[i].getUID());
97 for (
int i = 0;i <
nodes.size();i++) {
98 if (
nodes[i].isEndpoint()) {
101 if (
nodes[i].isCrossing()) {
104 if (
nodes[i].isConnector()) {
107 if (!
nodes[i].hasNeighbors()) {
130 return this->
edges.size();
134 return &this->
edges[_idx];
138 return this->
nodes[_idx];
145 std::vector< GraphNode< U > >
nodes;
const std::map< U, NODETYPE > getMapToIterate() const
Definition: Graph.h:45
std::map< NODETYPE, U > nodeByContent
Definition: Graph.h:142
std::vector< U > getEndnodeIDs()
Definition: Graph.h:75
void updateGraphProperties()
Definition: Graph.h:95
U getCrossingID(unsigned int _idx)
Definition: Graph.h:125
Graph()
Definition: Graph.h:25
unsigned int addNode(NODETYPE _node)
Definition: Graph.h:35
std::vector< U > crossings
Definition: Graph.h:152
U getEdgeCount()
Definition: Graph.h:129
std::map< std::pair< U, U >, U > forwardEdges
Definition: Graph.h:148
unsigned int getNumberOfCrossings() const
Definition: Graph.h:117
unsigned int numberOfAbandonedNodes
Definition: Graph.h:156
U getEndPointID(unsigned int _idx)
Definition: Graph.h:121
std::vector< U > getCrossingIDs()
Definition: Graph.h:85
U getNodeIDByContent(const NODETYPE _content) const
Definition: Graph.h:53
~Graph()
Definition: Graph.h:28
Definition: DirectedEdge.h:16
std::vector< GraphNode< U > > getGraphNodes()
Definition: Graph.h:71
std::vector< EDGETYPE > edges
Definition: Graph.h:147
unsigned int numberOfConnectors
Definition: Graph.h:155
std::vector< GraphNode< U > > nodes
Definition: Graph.h:145
std::map< U, NODETYPE > nodeByID
Definition: Graph.h:143
EDGETYPE * getEdge(unsigned int _idx)
Definition: Graph.h:133
std::map< std::pair< U, U >, U > backwardEdges
Definition: Graph.h:149
NODETYPE getNodeContentByID(U _id) const
Definition: Graph.h:62
std::vector< U > endPoints
Definition: Graph.h:151
GraphNode< U > getNode(unsigned int _idx)
Definition: Graph.h:137
unsigned int getNumberOfEndpoints() const
Definition: Graph.h:113
void clearProperties()
Definition: Graph.h:30
U getNodeCount() const
Definition: Graph.h:49
Definition: GraphNode.h:19