Rosetta  2020.11
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
utility::graph::DirectedEdge Class Reference

#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...
 
DirectedNodeget_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...
 
DirectedNodeget_tail_node ()
 returns a pointer to the tail node More...
 
DirectedNode const * get_head_node () const
 returns a pointer to the head node More...
 
DirectedNodeget_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...
 
DirectedNodeget_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...
 
Digraphget_owner ()
 get a non-const * to the owning graph More...
 

Private Member Functions

 DirectedEdge ()
 
 DirectedEdge (DirectedEdge const &)
 
DirectedEdgeoperator= (DirectedEdge &)
 

Private Attributes

platform::Size node_indices_ [2]
 
DirectedNodenodes_ [2]
 
DirectedEdgeListIter pos_in_nodes_edge_list_ [2]
 
DirectedEdgeListIter pos_in_owners_edge_list_
 
Digraphowner_
 

Member Typedef Documentation

Constructor & Destructor Documentation

utility::graph::DirectedEdge::~DirectedEdge ( )
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::DirectedNode::drop_edge(), utility::graph::Digraph::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.

Parameters
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 debug_assert, and utility::graph::Digraph::nodes_.

utility::graph::DirectedEdge::DirectedEdge ( )
private

Referenced by count_static_memory().

utility::graph::DirectedEdge::DirectedEdge ( DirectedEdge const &  )
private

Member Function Documentation

void utility::graph::DirectedEdge::copy_from ( DirectedEdge const *  source)
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().

platform::Size utility::graph::DirectedEdge::count_dynamic_memory ( ) const
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.

platform::Size utility::graph::DirectedEdge::count_static_memory ( ) const
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().

DirectedNode const* utility::graph::DirectedEdge::get_head_node ( ) const
inline

returns a pointer to the head node

References get_node().

DirectedNode* utility::graph::DirectedEdge::get_head_node ( )
inline

returns a pointer to the head node

References get_node().

platform::Size utility::graph::DirectedEdge::get_head_node_ind ( ) const
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().

DirectedNode const* utility::graph::DirectedEdge::get_node ( platform::Size  index) const
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, ObjexxFCL::index(), and nodes_.

Referenced by get_head_node(), and get_tail_node().

DirectedNode* utility::graph::DirectedEdge::get_node ( platform::Size  index)
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, ObjexxFCL::index(), and nodes_.

platform::Size utility::graph::DirectedEdge::get_node_index ( platform::Size  index) const
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, ObjexxFCL::index(), 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 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

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_.

Digraph const* utility::graph::DirectedEdge::get_owner ( ) const
inlineprotected

get a const * to the owning graph

References owner_.

Digraph* utility::graph::DirectedEdge::get_owner ( )
inlineprotected

get a non-const * to the owning graph

References owner_.

DirectedNode const* utility::graph::DirectedEdge::get_tail_node ( ) const
inline

returns a pointer to the tail node

References get_node().

DirectedNode* utility::graph::DirectedEdge::get_tail_node ( )
inline

returns a pointer to the tail node

References get_node().

platform::Size utility::graph::DirectedEdge::get_tail_node_ind ( ) const
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().

bool utility::graph::DirectedEdge::is_head_node ( platform::Size  node_index)
inline

References debug_assert, and node_indices_.

bool utility::graph::DirectedEdge::is_tail_node ( platform::Size  node_index)
inline

References debug_assert, and node_indices_.

DirectedEdge& utility::graph::DirectedEdge::operator= ( DirectedEdge )
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

Parameters
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().

Member Data Documentation

platform::Size utility::graph::DirectedEdge::node_indices_[2]
private
DirectedNode* utility::graph::DirectedEdge::nodes_[2]
private
Digraph* utility::graph::DirectedEdge::owner_
private

Referenced by get_owner(), and ~DirectedEdge().

DirectedEdgeListIter utility::graph::DirectedEdge::pos_in_nodes_edge_list_[2]
private

Referenced by ~DirectedEdge().

DirectedEdgeListIter utility::graph::DirectedEdge::pos_in_owners_edge_list_
private

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