#include <Beobot/Graph.H>
Public Member Functions | |
Constructor, assigment and destructor | |
Graph () | |
Constructor: generate a blank graph. | |
Graph (std::vector< rutz::shared_ptr< Node > > nodes, std::vector< rutz::shared_ptr< Edge > > edges) | |
Constructor: generate a graph with edges. | |
~Graph () | |
Destructor. | |
void | addNode (rutz::shared_ptr< Node >) |
add edges and nodes | |
void | addEdge (rutz::shared_ptr< Edge >) |
Access functions | |
uint | getNumNode () |
get node and edge size | |
uint | getNumEdge () |
rutz::shared_ptr< Node > | getNode (uint index) |
get node or edge of the passed in index | |
rutz::shared_ptr< Edge > | getEdge (uint index) |
Compute functions | |
void | computeAdjecencyList () |
compute the adjecency list | |
void | computeDistances () |
compute all the shortcuts for shortest-distance related operations | |
float | getDirectedDistance (uint a, uint b, std::vector< uint > &edges) |
float | getDirectedDistance (uint a, uint b) |
float | getUndirectedDistance (uint a, uint b, std::vector< uint > &edges) |
float | getUndirectedDistance (uint a, uint b) |
float | getMaxDirectedDistance () |
float | getMaxUndirectedDistance () |
std::vector< uint > | getDirectedPath (uint a, uint b) |
get the directed path from node A to Note B | |
std::vector< uint > | getUndirectedPath (uint a, uint b) |
get the undirected path from node A to Note B | |
std::vector< uint > | getEdges (rutz::shared_ptr< Node > n) |
get all the edge that connects to this node | |
float | getAngle (rutz::shared_ptr< Edge > e1, rutz::shared_ptr< Edge > e2) |
basic graph class has all the access functions and shortest path no input/output file function because usually the file has to be filled with extra information
Definition at line 50 of file Graph.H.
Graph::Graph | ( | std::vector< rutz::shared_ptr< Node > > | nodes, | |
std::vector< rutz::shared_ptr< Edge > > | edges | |||
) |
void Graph::addNode | ( | rutz::shared_ptr< Node > | node | ) |
void Graph::computeAdjecencyList | ( | ) |
void Graph::computeDistances | ( | ) |
compute all the shortcuts for shortest-distance related operations
Definition at line 143 of file Graph.C.
References getDirectedDistance(), getUndirectedDistance(), Image< T >::resize(), and Image< T >::setVal().
float Graph::getAngle | ( | rutz::shared_ptr< Edge > | e1, | |
rutz::shared_ptr< Edge > | e2 | |||
) |
get the angle (in radians) between two edges they two edges do not have to have a common node angles are intuitive from the tip of the incoming (e1) edge perspective 0 degrees/radians means continue the same direction 180/-180 degrees or M_PI/-M_PI means turn around positive angle to the right, negative angle to the left
Definition at line 485 of file Graph.C.
References Point2D< T >::i, and sqrt().
float Graph::getDirectedDistance | ( | uint | a, | |
uint | b, | |||
std::vector< uint > & | edges | |||
) |
get the shortest distance from node A to node B using Dijkstra shortest-path algorithm for the directed graph
Definition at line 189 of file Graph.C.
References ASSERT.
Referenced by computeDistances(), and getDirectedPath().
std::vector< uint > Graph::getDirectedPath | ( | uint | a, | |
uint | b | |||
) |
get the directed path from node A to Note B
Definition at line 440 of file Graph.C.
References getDirectedDistance().
std::vector< uint > Graph::getEdges | ( | rutz::shared_ptr< Node > | n | ) |
float Graph::getMaxDirectedDistance | ( | ) |
get the maximum distance of any 2 points in the map return -1.0F if the graph is unconnected for the directed graph
Definition at line 422 of file Graph.C.
References getMinMax(), max(), and min().
float Graph::getMaxUndirectedDistance | ( | ) |
get the maximum distance of any 2 points in the map return -1.0F if the graph is unconnected for undirected graph
Definition at line 431 of file Graph.C.
References getMinMax(), max(), and min().
rutz::shared_ptr< Node > Graph::getNode | ( | uint | index | ) | [inline] |
float Graph::getUndirectedDistance | ( | uint | a, | |
uint | b, | |||
std::vector< uint > & | edges | |||
) |
get the shortest distance from node A to node B using Dijkstra shortest-path algorithm for the undirected graph
Definition at line 308 of file Graph.C.
References ASSERT.
Referenced by computeDistances(), and getUndirectedPath().
std::vector< uint > Graph::getUndirectedPath | ( | uint | a, | |
uint | b | |||
) |
get the undirected path from node A to Note B
Definition at line 454 of file Graph.C.
References getUndirectedDistance().