HOG2
Public Member Functions | Private Attributes | List of all members
Graph Class Reference

A generic Graph class. More...

#include <Graph.h>

Inheritance diagram for Graph:
Inheritance graph
[legend]
Collaboration diagram for Graph:
Collaboration graph
[legend]

Public Member Functions

 Graph ()
 
 ~Graph ()
 
graph_objectClone () const
 
GraphcloneAll () const
 
void Reset ()
 
void Save (const char *file)
 
void Load (const char *file)
 
void Export (const char *fname)
 
int AddNode (node *)
 
nodeGetNode (unsigned long num)
 
const nodeGetNode (unsigned long num) const
 
edgeGetEdge (unsigned long num)
 
void AddEdge (edge *)
 
edgefindDirectedEdge (unsigned int from, unsigned int to)
 
edgeFindEdge (unsigned int from, unsigned int to)
 Finds an edge between nodes with ids from and to, no matter which direction. More...
 
const edgeFindEdge (unsigned int from, unsigned int to) const
 
bool relax (edge *e, int weightIndex)
 
bool relaxReverseEdge (edge *e, int weightIndex)
 
nodeGetRandomNode ()
 
edgeGetRandomEdge ()
 
node_iterator getNodeIter () const
 
nodenodeIterNext (node_iterator &) const
 
edge_iterator getEdgeIter () const
 
edgeedgeIterNext (edge_iterator &) const
 
void RemoveEdge (edge *)
 
nodeRemoveNode (node *, unsigned int &)
 
void RemoveNode (node *n)
 
void RemoveNode (unsigned int nodeNum)
 
int GetNumEdges ()
 
int GetNumNodes ()
 
std::vector< node * > * getReachableNodes (node *start)
 
bool verifyGraph () const
 
void Print (std::ostream &) const
 
void printStats ()
 
- Public Member Functions inherited from graph_object
 graph_object ()
 
virtual ~graph_object ()
 
virtual double GetKey ()
 

Private Attributes

std::vector< node * > _nodes
 
std::vector< edge * > _edges
 

Additional Inherited Members

- Public Attributes inherited from graph_object
unsigned int key
 

Detailed Description

A generic Graph class.

Definition at line 66 of file Graph.h.

Constructor & Destructor Documentation

◆ Graph()

Graph::Graph ( )

Definition at line 33 of file Graph.cpp.

Referenced by Clone(), and cloneAll().

◆ ~Graph()

Graph::~Graph ( )

Definition at line 39 of file Graph.cpp.

References Reset().

Member Function Documentation

◆ AddEdge()

void Graph::AddEdge ( edge e)

◆ AddNode()

int Graph::AddNode ( node n)

◆ Clone()

graph_object * Graph::Clone ( ) const
virtual

Implements graph_object.

Definition at line 77 of file Graph.cpp.

References AddNode(), node::Clone(), getNodeIter(), Graph(), and nodeIterNext().

◆ cloneAll()

Graph * Graph::cloneAll ( ) const

◆ edgeIterNext()

edge * Graph::edgeIterNext ( edge_iterator edge_iter) const

◆ Export()

void Graph::Export ( const char *  fname)

◆ findDirectedEdge()

edge * Graph::findDirectedEdge ( unsigned int  from,
unsigned int  to 
)

◆ FindEdge() [1/2]

edge * Graph::FindEdge ( unsigned int  from,
unsigned int  to 
)

Finds an edge between nodes with ids from and to, no matter which direction.

Returns
the edge found or null if no edge is found

Definition at line 230 of file Graph.cpp.

References node::_allEdges, node::edgeIterNext(), node::getEdgeIter(), edge::getFrom(), GetNode(), and edge::getTo().

Referenced by LoadedBBAbstraction::abstractGraph(), MapCliqueAbstraction::abstractUpEdge(), LoadedCliqueAbstraction::abstractUpEdge(), RadiusAbstraction::addEdges(), MapLineAbstraction::addEdges(), MapSectorAbstraction::addEdges(), NodeLimitAbstraction::addEdges(), MapLineAbstraction::addNodes(), MapCliqueAbstraction::checkNeighborClique(), LoadedCliqueAbstraction::checkNeighborClique(), MapCliqueAbstraction::cliqueAbstractGraph(), LoadedCliqueAbstraction::cliqueAbstractGraph(), GraphDistanceHeuristic::ComputeSizes(), ClusterAbstraction::createHorizEntrances(), ClusterAbstraction::createVertEntrances(), craStar::doRefinement(), IRAStar::ExpandNeighbors(), TopSpinGraph::ExpandNode(), aStar::extractPathToStart(), GraphMapInconsistentHeuristic::FillInCache(), GraphDistanceHeuristic::FindBestChild(), MapCliqueAbstraction::findEdgeParent(), LoadedCliqueAbstraction::findEdgeParent(), GraphDistanceHeuristic::FindFarNode(), hpaStar::findMapPath(), CanonicalGraphEnvironment::GCost(), GraphEnvironment::GCost(), corridorAStar::getBestPath(), MNPuzzle< width, height >::GetGraph(), craStar::getNextNode(), GraphDistanceHeuristic::GetOptimalDistances(), praStar::GetPath(), spreadPRAStar::GetPath(), praStar2::GetPath(), craStar::GetPath(), IRAStar::GetSolution(), AbstractionSearchEnvironment::heuristic(), OldSearchCode::GraphSearchEnvironment::heuristic(), IRAStar::Inconsistent(), LoadedCliqueAbstraction::neighborAbstractGraph(), hpaStar::nextPathNode(), craStar::nextPathNode(), WeightedMap2DEnvironment::OpenGLDraw(), IRDijkstra::RefineNode(), IRAStar::RefineNode(), CFOptimalRefinement::RefineNode(), CFOptimalRefinement::UpdateG(), CFOptimalRefinement::UpdateH(), SharedAMapGroup::UpdateLocation(), and CFOptimalRefinement::UpdateOptH().

◆ FindEdge() [2/2]

const edge * Graph::FindEdge ( unsigned int  from,
unsigned int  to 
) const

◆ GetEdge()

edge * Graph::GetEdge ( unsigned long  num)

Definition at line 164 of file Graph.cpp.

References _edges.

Referenced by FloydWarshall(), and Prim().

◆ getEdgeIter()

edge_iterator Graph::getEdgeIter ( ) const

◆ GetNode() [1/2]

node * Graph::GetNode ( unsigned long  num)

Definition at line 152 of file Graph.cpp.

References _nodes.

Referenced by LoadedBBAbstraction::abstractGraph(), NodeLimitAbstraction::abstractionBFS(), MapCliqueAbstraction::abstractUpEdge(), LoadedCliqueAbstraction::abstractUpEdge(), MapLineAbstraction::addEdges(), RadiusAbstraction::addEdges(), MapSectorAbstraction::addEdges(), NodeLimitAbstraction::addEdges(), LoadedBBAbstraction::addNeighborsInBox(), aStar::addNeighborsToCorridor(), MapLineAbstraction::addNodes(), MapCliqueAbstraction::addNodesToParent(), LoadedCliqueAbstraction::addNodesToParent(), MapCliqueAbstraction::addTunnel(), LoadedCliqueAbstraction::addTunnel(), praStar::astar(), MapFlatAbstraction::buildConnectivityGroups(), spreadPRAStar::buildNextAbstractPath(), praStar2::buildNextAbstractPath(), craStar::buildNextAbstractPath(), MapCliqueAbstraction::checkNeighborClique(), LoadedCliqueAbstraction::checkNeighborClique(), MapCliqueAbstraction::cliqueAbstractGraph(), LoadedCliqueAbstraction::cliqueAbstractGraph(), ClusterAbstraction::computeClusterPaths(), CanonicalGraphEnvironment::ComputeOrdering(), GraphDistanceHeuristic::ComputeSizes(), GraphOccupancyInterface::Convert(), GraphAbstraction::CountEdgesAtDistance(), craStar::doRefinement(), GraphEnvironment::Draw(), WeightedMap2DEnvironment::DrawEdge(), MeroB::DrawEdge(), LoadedBBAbstraction::DrawGraph(), LoadedCliqueAbstraction::DrawGraph(), GraphEnvironment::DrawLERP(), GraphEnvironment::DrawLine(), GraphEnvironment::DrawStateLabel(), IRDijkstra::ExpandNeighbors(), IRAStar::ExpandNeighbors(), aStarOld::extractBestPath(), corridorAStar::extractBestPath(), FringeSearch::extractBestPath(), GraphMapInconsistentHeuristic::FillInCache(), GraphDistanceHeuristic::FindAvoidNode(), GraphDistanceHeuristic::FindBestChild(), findDirectedEdge(), FindEdge(), MapCliqueAbstraction::findEdgeParent(), LoadedCliqueAbstraction::findEdgeParent(), GraphDistanceHeuristic::FindFarNode(), craStar::findGoalNode(), MapCliqueAbstraction::findNeighborCliques(), LoadedCliqueAbstraction::findNeighborCliques(), AbsGraphEnvironment::GCost(), praStar::getAbstractPath(), CanonicalGraphEnvironment::GetActionHash(), GraphEnvironment::GetActionHash(), GraphEnvironment::GetActions(), IRDijkstra::GetAllSolutionNodes(), IRAStar::GetAllSolutionNodes(), corridorAStar::getBestPath(), MapCliqueAbstraction::getChildGroups(), LoadedCliqueAbstraction::getChildGroups(), GraphInconsistencyExamples::GetExpoGraph(), MNPuzzle< width, height >::GetGraph(), MapCliqueAbstraction::getGroupSize(), LoadedCliqueAbstraction::getGroupSize(), GraphEnvironment::GetLocation(), AbstractionSearchEnvironment::getNeighbors(), OldSearchCode::GraphSearchEnvironment::getNeighbors(), OldSearchCode::MapGraphSearchEnvironment::getNeighbors(), craStar::getNextNode(), MapCliqueAbstraction::getNodeInGroup(), LoadedCliqueAbstraction::getNodeInGroup(), GraphAbstraction::GetNthParent(), GraphAbstraction::GetNumExternalEdges(), GraphEnvironment::GetNumSuccessors(), GraphDistanceHeuristic::GetOptimalDistances(), aStarOld::GetPath(), FringeSearch::GetPath(), AbstractWeightedSearchAlgorithm< state, action, environment >::GetPath(), IRDijkstra::GetRealNode(), IRAStar::GetRealNode(), CFOptimalRefinement::GetRealNode(), IRDijkstra::GetSolution(), IRAStar::GetSolution(), CanonicalGraphEnvironment::GetStateHash(), GraphEnvironment::GetStateHash(), GraphRefinementEnvironment::GetSuccessors(), CanonicalGraphEnvironment::GetSuccessors(), GraphEnvironment::GetSuccessors(), CanonicalGraphEnvironment::GLDrawLine(), GraphEnvironment::GLDrawLine(), GraphEnvironment::GLLabelState(), GraphRefinementEnvironment::GoalTest(), AbsGraphEnvironment::GoalTest(), GraphInconsistencyExamples::GraphHeuristic::HCost(), RoadMap::HCost(), GraphRefinementEnvironment::HCost(), GraphLabelHeuristic::HCost(), GraphMapHeuristic::HCost(), AbsGraphEnvironment::HCost(), GraphMapPerfectHeuristic::HCost(), GraphStraightLineHeuristic::HCost(), GraphMapInconsistentHeuristic::HCost(), OctileHeuristic::HCost(), AbstractionSearchEnvironment::heuristic(), OldSearchCode::MapGraphSearchEnvironment::heuristic(), IRAStar::Inconsistent(), ClusterAbstraction::insertNode(), MapCliqueAbstraction::insertNodeIntoHierarchy(), LoadedCliqueAbstraction::insertNodeIntoHierarchy(), LoadedCliqueAbstraction::loadGraph(), LoadedBBAbstraction::loadGraph(), SearchUnit::makeMove(), CFOptimalRefinement::MakeNeighborsOpen(), MapCliqueAbstraction::mergeGroupIntoNeighbor(), LoadedCliqueAbstraction::mergeGroupIntoNeighbor(), LoadedCliqueAbstraction::neighborAbstractGraph(), ClusterAbstraction::nodeExists(), CanonicalGraphEnvironment::OpenGLDraw(), IRDijkstra::OpenGLDraw(), IRAStar::OpenGLDraw(), CFOptimalRefinement::OpenGLDraw(), GraphDistanceHeuristic::OpenGLDraw(), GraphMapInconsistentHeuristic::OpenGLDraw(), GraphEnvironment::OpenGLDraw(), Prim(), AbsGraphEnvironment::Print(), ClusterAbstraction::printMapCoord(), FringeSearch::propagateGValues(), FringeSearch::propagateHValues(), IRDijkstra::RefineNode(), IRAStar::RefineNode(), CFOptimalRefinement::RefineNode(), relax(), aStarOld::relaxEdge(), praStar::relaxEdge(), relaxReverseEdge(), RemoveEdge(), RemoveNode(), MapCliqueAbstraction::resetLocationCache(), RoadMap::RoadMap(), ClusterAbstraction::setUpParents(), IRDijkstra::ShouldAddEdge(), IRAStar::ShouldAddEdge(), CFOptimalRefinement::ShouldAddEdge(), GraphEnvironment::SVGDraw(), GraphEnvironment::SVGLabelState(), MapCliqueAbstraction::transferGroup(), LoadedCliqueAbstraction::transferGroup(), CFOptimalRefinement::UpdateG(), CFOptimalRefinement::UpdateH(), CFOptimalRefinement::UpdateOptH(), LoadedBBAbstraction::VerifyHierarchy(), MapCliqueAbstraction::VerifyHierarchy(), LoadedCliqueAbstraction::VerifyHierarchy(), and GraphAbstraction::WidthBFS().

◆ GetNode() [2/2]

const node * Graph::GetNode ( unsigned long  num) const

Definition at line 158 of file Graph.cpp.

References _nodes.

◆ getNodeIter()

node_iterator Graph::getNodeIter ( ) const

◆ GetNumEdges()

int Graph::GetNumEdges ( )

◆ GetNumNodes()

int Graph::GetNumNodes ( )

◆ GetRandomEdge()

edge * Graph::GetRandomEdge ( )

Definition at line 288 of file Graph.cpp.

References _edges.

◆ GetRandomNode()

node * Graph::GetRandomNode ( )

◆ getReachableNodes()

vector< node * > * Graph::getReachableNodes ( node start)

Definition at line 409 of file Graph.cpp.

References _nodes, node::getNeighborIter(), node::GetNum(), and node::nodeNeighborNext().

◆ Load()

void Graph::Load ( const char *  file)

◆ nodeIterNext()

node * Graph::nodeIterNext ( node_iterator node_iter) const

◆ Print()

void Graph::Print ( std::ostream &  ) const
virtual

Reimplemented from graph_object.

Definition at line 446 of file Graph.cpp.

References edgeIterNext(), getEdgeIter(), getNodeIter(), and nodeIterNext().

Referenced by operator<<().

◆ printStats()

void Graph::printStats ( )

◆ relax()

bool Graph::relax ( edge e,
int  weightIndex 
)

◆ relaxReverseEdge()

bool Graph::relaxReverseEdge ( edge e,
int  weightIndex 
)

◆ RemoveEdge()

void Graph::RemoveEdge ( edge e)

◆ RemoveNode() [1/3]

node * Graph::RemoveNode ( node n,
unsigned int &  oldID 
)

◆ RemoveNode() [2/3]

void Graph::RemoveNode ( node n)
inline

Definition at line 102 of file Graph.h.

References RemoveNode().

Referenced by RemoveNode().

◆ RemoveNode() [3/3]

void Graph::RemoveNode ( unsigned int  nodeNum)
inline

Definition at line 103 of file Graph.h.

References GetNode(), and RemoveNode().

Referenced by RemoveNode().

◆ Reset()

void Graph::Reset ( )

Definition at line 45 of file Graph.cpp.

References _edges, _nodes, edgeIterNext(), getEdgeIter(), getNodeIter(), and nodeIterNext().

Referenced by ~Graph().

◆ Save()

void Graph::Save ( const char *  file)

◆ verifyGraph()

bool Graph::verifyGraph ( ) const

Definition at line 496 of file Graph.cpp.

References _edges, _nodes, edgeIterNext(), getEdgeIter(), getNodeIter(), and nodeIterNext().

Member Data Documentation

◆ _edges

std::vector<edge *> Graph::_edges
private

◆ _nodes

std::vector<node *> Graph::_nodes
private

The documentation for this class was generated from the following files: