Rosetta  2020.37
 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::Edge Class Reference

#include <Graph.hh>

Public Types

typedef EdgeListIterator EdgeListIter
 

Public Member Functions

virtual ~Edge ()
 destructor More...
 
 Edge (Graph *owner, platform::Size first_node_ind, platform::Size second_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 Graph's delete_edge method, and this method absolutely must be implemented by derived Graph classes. More...
 
virtual void copy_from (Edge const *source)
 copy-from for use in Graph::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...
 
Node 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...
 
Nodeget_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_first_node_ind () const
 returns the index of the lower node More...
 
platform::Size get_second_node_ind () const
 returns the index of the upper node More...
 
void set_pos_in_owners_list (EdgeListIter edge_iterator)
 called only by class Graph, this function gives the Edge the data it needs to later delete itself from its owner's edge list in constant time. More...
 
bool same_edge (platform::Size node1, platform::Size node2) const
 Is this the same edge as another edge (node1,node2)? Note: this graph does not work for multi-graphs. Edges must be unique. More...
 
bool is_loop () const
 Is this edge a loop? In Pseudographs, loop edges are incident twice on a single vertex. 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. More...
 
Node 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 More...
 
Nodeget_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...
 
Graph const * get_owner () const
 get a const * to the owning graph More...
 
Graphget_owner ()
 get a non-const * to the owning graph More...
 

Private Member Functions

 Edge ()
 
 Edge (Edge const &)
 
Edgeoperator= (Edge &)
 

Private Attributes

std::array< platform::Size, 2 > node_indices_
 
std::array< Node *, 2 > nodes_
 
std::array< EdgeListIter, 2 > pos_in_nodes_edge_list_
 
EdgeListIter pos_in_owners_edge_list_
 
Graphowner_
 

Member Typedef Documentation

Constructor & Destructor Documentation

utility::graph::Edge::~Edge ( )
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::Graph::drop_edge(), is_loop(), nodes_, owner_, pos_in_nodes_edge_list_, and pos_in_owners_edge_list_.

utility::graph::Edge::Edge ( Graph owner,
platform::Size  first_node_ind,
platform::Size  second_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 Graph's delete_edge method, and this method absolutely must be implemented by derived Graph 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 InteractionGraph
first_node_ind- [in] - the index of the first node
second_node_ind- [in] - the index of the second node

References debug_assert, and utility::graph::Graph::nodes_.

utility::graph::Edge::Edge ( )
private

Referenced by count_static_memory().

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

Member Function Documentation

void utility::graph::Edge::copy_from ( Edge const *  source)
virtual

copy-from for use in Graph::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::Graph::Graph().

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

platform::Size utility::graph::Edge::get_first_node_ind ( ) const
inline

returns the index of the lower node

References node_indices_.

Referenced by utility::graph::Graph::add_edge(), and utility::graph::Graph::create_new_edge().

Node const* utility::graph::Edge::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

References debug_assert, ObjexxFCL::index(), and nodes_.

Referenced by create_bp_jump_database_test(), define_interface(), gen_pep_bb_sequential(), get_clash_pairs(), harvest_motifs(), has_clash(), main(), make_fragments(), mutate_random_residue(), and run_pep_prep().

Node* utility::graph::Edge::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::Edge::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.

References debug_assert, ObjexxFCL::index(), and node_indices_.

platform::Size utility::graph::Edge::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_.

Referenced by utility::graph::Node::add_edge(), and utility::graph::Node::drop_edge().

Node const * utility::graph::Edge::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

Node * utility::graph::Edge::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_.

Graph const* utility::graph::Edge::get_owner ( ) const
inlineprotected

get a const * to the owning graph

References owner_.

Graph* utility::graph::Edge::get_owner ( )
inlineprotected

get a non-const * to the owning graph

References owner_.

platform::Size utility::graph::Edge::get_second_node_ind ( ) const
inline

returns the index of the upper node

References node_indices_.

Referenced by utility::graph::Graph::add_edge(), and utility::graph::Graph::create_new_edge().

bool utility::graph::Edge::is_loop ( ) const
inline

Is this edge a loop? In Pseudographs, loop edges are incident twice on a single vertex.

References node_indices_.

Referenced by utility::graph::Node::add_edge(), and ~Edge().

Edge& utility::graph::Edge::operator= ( Edge )
private
bool utility::graph::Edge::same_edge ( platform::Size  node1,
platform::Size  node2 
) const

Is this the same edge as another edge (node1,node2)? Note: this graph does not work for multi-graphs. Edges must be unique.

returns true if this edge connects nodes of index node1 and node2 the order of node1 and node2 is not important

Parameters
node1- [in] - index of one of the two nodes
node2- [in] - index of the other of the two nodes

References node_indices_, and erraser_analysis::temp.

Referenced by utility::graph::Graph::find_edge().

void utility::graph::Edge::set_pos_in_owners_list ( EdgeListIter  edge_iterator)

called only by class Graph, this function gives the Edge 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::Graph::add_edge().

Member Data Documentation

std::array< platform::Size, 2 > utility::graph::Edge::node_indices_
private
std::array< Node*, 2 > utility::graph::Edge::nodes_
private

Referenced by get_node(), get_other_node(), and ~Edge().

Graph* utility::graph::Edge::owner_
private

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

std::array< EdgeListIter, 2 > utility::graph::Edge::pos_in_nodes_edge_list_
private

Referenced by ~Edge().

EdgeListIter utility::graph::Edge::pos_in_owners_edge_list_
private

Referenced by set_pos_in_owners_list(), and ~Edge().


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