libmove3d-planners
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Friends | List of all members
mho::SimpleGraph Class Reference
Inheritance diagram for mho::SimpleGraph:
mho::GraphInterface

Public Member Functions

 SimpleGraph (bool directed=false)
 
SimpleGraphclone (void)
 
bool isDirected ()
 isDirected More...
 
NodeInterfaceaddNode (NodeInterface *n)
 addNode More...
 
NodeInterfaceaddNode (Node *n)
 
virtual void connectNodes (NodeInterface *n1, NodeInterface *n2, cost_t c)
 connectNodes connect 2 nodes. More...
 
void updateCost (NodeInterface *n1, NodeInterface *n2, cost_t newcost, cost_t oldcost, bool onlySpecifiedCost=true)
 update the cost of an edge specified by its pre and post node, eventually its cost More...
 
void updateCost (NodeInterface *n1, NodeInterface *n2, cost_t newcost)
 
void updateCost (EdgeInterface *edge, cost_t cost)
 
NodeInterfaceat (unsigned int i)
 at returns the node at given index More...
 
EdgeInterfaceedgeAt (unsigned int i)
 
std::vector< NodeInterface * > sonsNodes (NodeInterface *i)
 
std::vector< EdgeInterface * > sons (NodeInterface *i)
 
std::vector< NodeInterface * > getNodes (void)
 
unsigned int size (void)
 size the number of nodes More...
 
unsigned int edgesNumber (void)
 
void clear (void)
 

Protected Attributes

std::vector< Edge * > _edges
 
std::vector< Node * > _nodes
 
bool _is_directed
 
unsigned int _count
 

Friends

std::ostream & operator<< (std::ostream &os, SimpleGraph &g)
 

Member Function Documentation

NodeInterface * mho::SimpleGraph::addNode ( NodeInterface n)
virtual

addNode

Parameters
nmakes a local copy of the node

Implements mho::GraphInterface.

NodeInterface * mho::SimpleGraph::at ( unsigned int  i)
virtual

at returns the node at given index

Parameters
iindex
Returns
reference to node at i

Implements mho::GraphInterface.

void mho::SimpleGraph::connectNodes ( NodeInterface n1,
NodeInterface n2,
cost_t  c 
)
virtual

connectNodes connect 2 nodes.

Parameters
n1first node
n2second node
ccost if directed graph, makes an arrow n1 -> n2 otherwise n1 <-> n2

Implements mho::GraphInterface.

bool mho::SimpleGraph::isDirected ( )
virtual

isDirected

Returns
true if directed graph

Implements mho::GraphInterface.

unsigned int mho::SimpleGraph::size ( void  )
virtual

size the number of nodes

Returns

Implements mho::GraphInterface.

void mho::SimpleGraph::updateCost ( NodeInterface n1,
NodeInterface n2,
cost_t  newcost,
cost_t  oldcost,
bool  onlySpecifiedCost = true 
)

update the cost of an edge specified by its pre and post node, eventually its cost

Parameters
n1pre node
n2post node (may be swapped in undirected graphs)
newcostcost to assign
oldcostcurrent cost of the edge
onlySpecifiedCostignore oldcost if false and change cost of all edges from n1 to n2

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