typedef map <A, Edge<A> > adjacency | adjacency |
typedef ref_ptr<Node<A> > NodeRef | NodeRef |
Node (A a, bool trace = false)
| Node |
A nodename ()
| nodename |
Returns: nodename
bool add_edge (NodeRef dst, int weight)
| add_edge |
Add a new edge.
Returns: true on success. false if edge already exists.
bool update_edge_weight (NodeRef dst, int weight)
| update_edge_weight |
Update edge weight.
Returns: true on success, false if the edge doesn't exist.
bool get_edge_weight (NodeRef dst, int& weight)
| get_edge_weight |
Get edge weight.
Returns: true on success, false if the edge doesn't exist.
bool remove_edge (NodeRef dst)
| remove_edge |
void drop_adjacencies ()
| drop_adjacencies |
Drop all adjacencies. Used to revive invalid nodes.
void garbage_collect ()
| garbage_collect |
Remove all edges that point at invalid nodes.
void set_valid (bool p)
| set_valid |
bool valid ()
| valid |
Returns: true if this node is not marked for deletion.
void set_tentative (bool p)
| set_tentative |
bool tentative ()
| tentative |
void invalidate_weights ()
| invalidate_weights |
bool valid_weight ()
| valid_weight |
void set_adjacent_weights (NodeRef me, int delta_weight,
PriorityQueue<A>& tentative)
| set_adjacent_weights |
Set weights. Visit all neighbours that are tentative and add this weight.
Parameters:
delta_weight | to add to this node. |
tentative | add all updated adjacent nodes to the tentative set. |
bool set_local_weight (int weight)
| set_local_weight |
Set local weight. Set the weight on this node if its tentative and less than the previous value.
Returns: true if its accepted.
int get_local_weight ()
| get_local_weight |
get local weight.
void set_first_hop (NodeRef n)
| set_first_hop |
NodeRef get_first_hop ()
| get_first_hop |
void set_last_hop (NodeRef n)
| set_last_hop |
NodeRef get_last_hop ()
| get_last_hop |
bool delta (RouteCmd<A>& rcmd)
| delta |
Return the difference between this computation and the last.
Parameters:
rcmd | the new route to this node if it has changed. |
Returns: true if the node has changed.
void clear ()
| clear |
Clear all the references to other nodes as well as possible references to ourselves.
string pp ()
| pp |
[const]
Pretty print this node with its adjacencies
string str ()
| str |
[const]
Returns: C++ string with the human-readable ASCII representation of the node.