Rosetta
|
#include <Digraph.hh>
Public Types | |
typedef DirectedEdgeListIterator | DirectedEdgeListIter |
Public Member Functions | |
virtual | ~DirectedEdge () |
destructor More... | |
DirectedEdge (Digraph *owner, platform::Size tail_node_ind, platform::Size head_node_ind) | |
Main edge constructor. This should only be invoked by create_new_edge, which itself is only called by add_edge. The ONLY way an edge should be added to a graph is through add_edge. NOTE: edges should be only be deleted by a call to the Digraph's delete_edge method, and this method absolutely must be implemented by derived Digraph classes. More... | |
virtual void | copy_from (DirectedEdge const *source) |
copy-from for use in Digraph::operator= and copy ctors More... | |
platform::Size | get_other_ind (platform::Size node_index) const |
returns the index of the one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More... | |
DirectedNode const * | get_other_node (platform::Size node_index) const |
returns a const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More... | |
DirectedNode * | get_other_node (platform::Size node_index) |
returns a non-const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon. More... | |
platform::Size | get_tail_node_ind () const |
returns the index of the tail node More... | |
platform::Size | get_head_node_ind () const |
returns the index of the upper node More... | |
DirectedNode const * | get_tail_node () const |
returns a pointer to the tail node More... | |
DirectedNode * | get_tail_node () |
returns a pointer to the tail node More... | |
DirectedNode const * | get_head_node () const |
returns a pointer to the head node More... | |
DirectedNode * | get_head_node () |
returns a pointer to the head node More... | |
bool | is_tail_node (platform::Size node_index) |
bool | is_head_node (platform::Size node_index) |
void | set_pos_in_owners_list (DirectedEdgeListIter edge_iterator) |
called only by class Digraph, this function gives the DirectedEdge the data it needs to later delete itself from its owner's edge list in constant time. More... | |
bool | same_edge (platform::Size tail_node, platform::Size head_node) const |
Is this the same edge as another edge (tail_node,head_node)? Note: this graph does not work for multi-graphs. DirectedEdges must be unique. More... | |
virtual platform::Size | count_static_memory () const |
how much memory is statically allocated by this edge More... | |
virtual platform::Size | count_dynamic_memory () const |
how much memory is dynamically allocated by this edge – must be recursively invoked by a derived class. More... | |
Protected Member Functions | |
platform::Size | get_node_index (platform::Size index) const |
get the node index for one of the two nodes this edge is incident upon uses c-style index-from-0. 0 is the index of the tail node, 1 is the index of the head node. More... | |
DirectedNode const * | get_node (platform::Size index) const |
get a const * to one node that this edge is incident upon uses c-style index-from-0 for these two nodes. 0 is the index of the tail node, 1 is the index of the head node. More... | |
DirectedNode * | get_node (platform::Size index) |
get a non-const * to one node that this edge is incident upon uses c-style index-from-0 for these two nodes More... | |
Digraph const * | get_owner () const |
get a const * to the owning graph More... | |
Digraph * | get_owner () |
get a non-const * to the owning graph More... | |
Private Member Functions | |
DirectedEdge () | |
DirectedEdge (DirectedEdge const &) | |
DirectedEdge & | operator= (DirectedEdge &) |
Private Attributes | |
platform::Size | node_indices_ [2] |
DirectedNode * | nodes_ [2] |
DirectedEdgeListIter | pos_in_nodes_edge_list_ [2] |
DirectedEdgeListIter | pos_in_owners_edge_list_ |
Digraph * | owner_ |
|
virtual |
destructor
removes all record of this edge from edge-lists of the 1) nodes this edge is incident upon and 2) the owning interaction graph
References utility::graph::Digraph::drop_edge(), utility::graph::DirectedNode::drop_edge(), nodes_, owner_, pos_in_nodes_edge_list_, and pos_in_owners_edge_list_.
utility::graph::DirectedEdge::DirectedEdge | ( | Digraph * | owner, |
platform::Size | tail_node_ind, | ||
platform::Size | head_node_ind | ||
) |
Main edge constructor. This should only be invoked by create_new_edge, which itself is only called by add_edge. The ONLY way an edge should be added to a graph is through add_edge. NOTE: edges should be only be deleted by a call to the Digraph's delete_edge method, and this method absolutely must be implemented by derived Digraph classes.
main constructor for edge, no default nor copy constructors
edge adds itself to the edge list of the two nodes its set to be incident upon, and stores the list-iterators that the nodes return.
owner | - [in] - owning InteractionDigraph |
tail_node_ind | - [in] - the index of the tail node |
head_node_ind | - [in] - the index of the head node |
References utility::graph::DirectedNode::add_incoming_edge(), utility::graph::DirectedNode::add_outgoing_edge(), debug_assert, node_indices_, nodes_, utility::graph::Digraph::nodes_, and pos_in_nodes_edge_list_.
|
private |
Referenced by count_static_memory().
|
private |
|
virtual |
copy-from for use in Digraph::operator= and copy ctors
derived classes should recursively call the copy_from method to ensure all parent class data is copied. It just so happens that this method does nothing, but that could change and the derived class should include a call to this function for that reason.
Referenced by utility::graph::Digraph::Digraph().
|
virtual |
how much memory is dynamically allocated by this edge – must be recursively invoked by a derived class.
memory accounting scheme
This method should be called recursively by derived classes – that is, each class should recurse to its parent.
|
virtual |
how much memory is statically allocated by this edge
memory accouting scheme
This is called non-recursively on the most-derived class
References DirectedEdge().
|
inline |
returns a pointer to the head node
References get_node().
|
inline |
returns a pointer to the head node
References get_node().
|
inline |
returns the index of the upper node
References node_indices_.
Referenced by utility::graph::Digraph::add_edge(), and utility::graph::Digraph::create_new_edge().
|
inlineprotected |
get a non-const * to one node that this edge is incident upon uses c-style index-from-0 for these two nodes
References debug_assert, and nodes_.
|
inlineprotected |
get a const * to one node that this edge is incident upon uses c-style index-from-0 for these two nodes. 0 is the index of the tail node, 1 is the index of the head node.
References debug_assert, and nodes_.
Referenced by get_head_node(), and get_tail_node().
|
inlineprotected |
get the node index for one of the two nodes this edge is incident upon uses c-style index-from-0. 0 is the index of the tail node, 1 is the index of the head node.
References debug_assert, and node_indices_.
platform::Size utility::graph::DirectedEdge::get_other_ind | ( | platform::Size | node_index | ) | const |
returns the index of the one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.
returns the index of the other node that the edge is incident upon
References debug_assert, and node_indices_.
DirectedNode * utility::graph::DirectedEdge::get_other_node | ( | platform::Size | node_index | ) |
returns a non-const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.
returns a pointer to the other node that the edge is incident upon
References debug_assert, node_indices_, and nodes_.
DirectedNode const * utility::graph::DirectedEdge::get_other_node | ( | platform::Size | node_index | ) | const |
returns a const pointer to one node given the index of the other. node_index must be one of the two nodes that this edge is incident upon.
return a const pointer to the other node that the edge is incident upon
|
inlineprotected |
get a non-const * to the owning graph
References owner_.
|
inlineprotected |
get a const * to the owning graph
References owner_.
|
inline |
returns a pointer to the tail node
References get_node().
|
inline |
returns a pointer to the tail node
References get_node().
|
inline |
returns the index of the tail node
References node_indices_.
Referenced by utility::graph::Digraph::add_edge(), and utility::graph::Digraph::create_new_edge().
|
inline |
References debug_assert, and node_indices_.
|
inline |
References debug_assert, and node_indices_.
|
private |
bool utility::graph::DirectedEdge::same_edge | ( | platform::Size | tail_node, |
platform::Size | head_node | ||
) | const |
Is this the same edge as another edge (tail_node,head_node)? Note: this graph does not work for multi-graphs. DirectedEdges must be unique.
returns true if this edge connects nodes of index tail_node and head_node the order of tail_node and head_node is not important
tail_node | - [in] - index of the tail node |
head_node | - [in] - index of the head node |
References node_indices_.
Referenced by utility::graph::Digraph::find_edge().
void utility::graph::DirectedEdge::set_pos_in_owners_list | ( | DirectedEdgeListIter | edge_iterator | ) |
called only by class Digraph, this function gives the DirectedEdge the data it needs to later delete itself from its owner's edge list in constant time.
sets the iterator for this edge's position in its owner's edge list
References debug_assert, and pos_in_owners_edge_list_.
Referenced by utility::graph::Digraph::add_edge().
|
private |
Referenced by DirectedEdge(), get_head_node_ind(), get_node_index(), get_other_ind(), get_other_node(), get_tail_node_ind(), is_head_node(), is_tail_node(), and same_edge().
|
private |
Referenced by DirectedEdge(), get_node(), get_other_node(), and ~DirectedEdge().
|
private |
Referenced by get_owner(), and ~DirectedEdge().
|
private |
Referenced by DirectedEdge(), and ~DirectedEdge().
|
private |
Referenced by set_pos_in_owners_list(), and ~DirectedEdge().