Rosetta  3.8
 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::Node Class Reference

#include <Graph.hh>

Public Types

typedef EdgeListIterator EdgeListIter
 
typedef EdgeListConstIterator EdgeListConstIter
 

Public Member Functions

virtual ~Node ()
 virtual destructor More...
 
 Node (Graph *, platform::Size node_id)
 Main constructor, no default constructor nor copy constructor. More...
 
virtual void copy_from (Node const *source)
 invoked during graph assignment operators to copy any node data from one graph to another graph. The source node must be the same type as this node. More...
 
void add_edge (Edge *edge_ptr, EdgeListIter &)
 adds edge pointer to edge list; returns an iterator to the new list element More...
 
void drop_edge (EdgeListIter edge_iterator)
 removes an edge iterator from the node's edge list. Only called by Edge class. More...
 
void drop_all_edges ()
 deletes all edges incident upon this node More...
 
void set_num_neighbors_counting_self_static (platform::Size neighbor)
 
Edge const * find_edge (platform::Size other_node_index) const
 a "slow" (linear) search for an edge. More...
 
Edgefind_edge (platform::Size other_node_index)
 non-const edge finding method; changes no data, but returns a non-const pointer More...
 
virtual void print () const
 send summaray data about this node to the screen More...
 
EdgeListIter edge_list_begin ()
 returns a non-const iterator to the beginning of its edge list More...
 
EdgeListConstIter const_edge_list_begin () const
 returns a const iterator to the beginning of its edge list More...
 
EdgeListIter edge_list_end ()
 returns a non-const iterator to the end of its edge list More...
 
EdgeListConstIter const_edge_list_end () const
 returns a const iterator to the end of its edge list More...
 
EdgeListIter lower_edge_list_begin ()
 returns a non-const iterator to the beginning of its lower-edge list More...
 
EdgeListConstIter const_lower_edge_list_begin () const
 returns a const iterator to the beginning of its lower-edge list More...
 
EdgeListIter lower_edge_list_end ()
 returns a non-const iterator to the end of its lower-edge list More...
 
EdgeListConstIter const_lower_edge_list_end () const
 returns a const iterator to the end of its lower-edge list More...
 
EdgeListIter upper_edge_list_begin ()
 returns a non-const iterator to the beginning of its upper-edge list More...
 
EdgeListConstIter const_upper_edge_list_begin () const
 returns a const iterator to the beginning of its upper-edge list More...
 
EdgeListIter upper_edge_list_end ()
 returns a non-const iterator to the end of its upper-edge list More...
 
EdgeListConstIter const_upper_edge_list_end () const
 returns a const iterator to the end of its upper-edge list More...
 
platform::Size get_node_index () const
 the index for this node More...
 
platform::Size num_edges () const
 the number of edges incident on this node, which may include a loop edge More...
 
platform::Size num_neighbors_counting_self () const
 the number of neighbors counting "self" as a neighbor. More...
 
platform::Size num_neighbors_counting_self_static () const
 the number of neighbors counting "self" as neighbor. Defaults to num_neighbors_counting_self() but can be set to other values as well. Useful in calculation of symmetrical structures. More...
 
platform::Size get_num_edges_to_smaller_indexed_nodes () const
 the number of lower neighbors More...
 
platform::Size get_num_edges_to_larger_indexed_nodes () const
 the number of upper neighbors – which "self" neighborness is counted if a loop edge is present More...
 
virtual platform::Size count_static_memory () const
 memory accounting scheme More...
 
virtual platform::Size count_dynamic_memory () const
 memory accounting scheme More...
 
bool loop_incident () const
 NOTE TO SELF: remove loop support. More...
 

Protected Member Functions

Graphget_owner () const
 derived class access to the owner More...
 

Private Member Functions

 Node ()
 
 Node (Node const &)
 
Nodeoperator= (Node &)
 

Private Attributes

platform::Size node_index_
 
platform::Size num_incident_edges_
 
platform::Size num_neighbors_counting_self_static_
 
bool loop_incident_
 
platform::Size num_edges_to_smaller_indexed_nodes_
 NOTE TO SELF: remove loop support. More...
 
platform::Size num_edges_to_larger_indexed_nodes_
 
EdgeList incident_edge_list_
 
EdgeListIter first_upper_edge_
 
Graphowner_
 

Member Typedef Documentation

Constructor & Destructor Documentation

utility::graph::Node::~Node ( )
virtualdefault

virtual destructor

utility::graph::Node::Node ( Graph owner,
platform::Size  node_id 
)

Main constructor, no default constructor nor copy constructor.

utility::graph::Node::Node ( )
private

Referenced by count_static_memory().

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

Member Function Documentation

void utility::graph::Node::add_edge ( Edge edge_ptr,
EdgeListIter eiter 
)

adds edge pointer to edge list; returns an iterator to the new list element

If the other node this node is attached to by edge_ptr has a higher index then the edge is added to the end of its edge list; if the node has a smaller index, the edge pointer is added to the front of the edge list. The presence of a new edge means the edge vector is not up to date.

Parameters
edge_ptr- [in] - the new edge

References utility::graph::EdgeList::begin(), debug_assert, utility::graph::EdgeList::end(), first_upper_edge_, utility::graph::Edge::get_other_ind(), incident_edge_list_, utility::graph::EdgeList::insert(), utility::graph::Edge::is_loop(), loop_incident_, node_index_, num_edges_to_larger_indexed_nodes_, num_edges_to_smaller_indexed_nodes_, num_incident_edges_, num_neighbors_counting_self(), and num_neighbors_counting_self_static_.

EdgeListConstIter utility::graph::Node::const_edge_list_begin ( ) const
inline

returns a const iterator to the beginning of its edge list

References utility::graph::EdgeList::const_begin(), and incident_edge_list_.

Referenced by utility::graph::find_connected_components().

EdgeListConstIter utility::graph::Node::const_edge_list_end ( ) const
inline
EdgeListConstIter utility::graph::Node::const_lower_edge_list_begin ( ) const
inline

returns a const iterator to the beginning of its lower-edge list

References utility::graph::EdgeList::const_begin(), and incident_edge_list_.

EdgeListConstIter utility::graph::Node::const_lower_edge_list_end ( ) const
inline

returns a const iterator to the end of its lower-edge list

References first_upper_edge_.

EdgeListConstIter utility::graph::Node::const_upper_edge_list_begin ( ) const
inline

returns a const iterator to the beginning of its upper-edge list

References first_upper_edge_.

EdgeListConstIter utility::graph::Node::const_upper_edge_list_end ( ) const
inline

returns a const iterator to the end of its upper-edge list

References utility::graph::EdgeList::const_end(), and incident_edge_list_.

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

invoked during graph assignment operators to copy any node data from one graph to another graph. The source node must be the same type as this node.

copy-from for use in Graph::operator= and copy ctors; derived classes must define their own version of this function

platform::Size utility::graph::Node::count_dynamic_memory ( ) const
virtual

memory accounting scheme

recursively descend through heirarchy accounting for heap memory usage. Each derived class in the heirarchy should recursively add the amount of dynamic memory its parent allocates by calling parent::count_dynamic_memory

References num_incident_edges_.

platform::Size utility::graph::Node::count_static_memory ( ) const
virtual

memory accounting scheme

called on most-derived class. The most-derived class should NOT recursively call this method on its parent class. The sizeof function will handle the whole Node (or DerivedNode).

References Node().

void utility::graph::Node::drop_all_edges ( )

deletes all edges incident upon this node

As edges delete themselves, they invalidate any iterators that point to their (former) positions in the node and graph edge lists. Therefore, before calling delete on an edge object, one must grab the next iterator in a list. Below, nextiter copies iter and is incremented before iter's edge is deleted. Note also that "++iter" does not appear in the for loop.

References utility::graph::EdgeList::begin(), utility::graph::Graph::delete_edge(), utility::graph::EdgeList::end(), incident_edge_list_, and owner_.

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

void utility::graph::Node::drop_edge ( EdgeListIter  eiter)

removes an edge iterator from the node's edge list. Only called by Edge class.

edges efficiently delete themselves from the edge lists of the nodes they are incident upon by keeping a pair of iterators. Edges request nodes delete them by handing the iterator back to the node.

Parameters
edge- [in] - the iterator for this node's edge list that points at the edge which is trying to delete itself

References utility::graph::EdgeList::erase(), first_upper_edge_, utility::graph::Edge::get_other_ind(), incident_edge_list_, loop_incident_, node_index_, num_edges_to_larger_indexed_nodes_, num_edges_to_smaller_indexed_nodes_, num_incident_edges_, num_neighbors_counting_self(), and num_neighbors_counting_self_static_.

Referenced by utility::graph::Edge::~Edge().

EdgeListIter utility::graph::Node::edge_list_begin ( )
inline

returns a non-const iterator to the beginning of its edge list

References utility::graph::EdgeList::begin(), and incident_edge_list_.

EdgeListIter utility::graph::Node::edge_list_end ( )
inline

returns a non-const iterator to the end of its edge list

References utility::graph::EdgeList::end(), and incident_edge_list_.

Edge const * utility::graph::Node::find_edge ( platform::Size  other_node) const

a "slow" (linear) search for an edge.

Constant time if each vertex has a constant number of edges. Edges are identified by the index of the node to which the edge connects this node. Returns NULL when there is no such connecting edge.

Parameters
other_node- [in] - the index of the node that the desired edge connects this node to
Edge * utility::graph::Node::find_edge ( platform::Size  other_node_index)
platform::Size utility::graph::Node::get_node_index ( ) const
inline

the index for this node

References node_index_.

Referenced by find_edge().

platform::Size utility::graph::Node::get_num_edges_to_larger_indexed_nodes ( ) const
inline

the number of upper neighbors – which "self" neighborness is counted if a loop edge is present

References num_edges_to_larger_indexed_nodes_.

platform::Size utility::graph::Node::get_num_edges_to_smaller_indexed_nodes ( ) const
inline

the number of lower neighbors

References num_edges_to_smaller_indexed_nodes_.

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

derived class access to the owner

References owner_.

bool utility::graph::Node::loop_incident ( ) const
inline

NOTE TO SELF: remove loop support.

References loop_incident_.

EdgeListIter utility::graph::Node::lower_edge_list_begin ( )
inline

returns a non-const iterator to the beginning of its lower-edge list

References utility::graph::EdgeList::begin(), and incident_edge_list_.

EdgeListIter utility::graph::Node::lower_edge_list_end ( )
inline

returns a non-const iterator to the end of its lower-edge list

References first_upper_edge_.

Referenced by define_interface(), get_clash_pairs(), has_clash(), and main().

platform::Size utility::graph::Node::num_edges ( ) const
inline

the number of edges incident on this node, which may include a loop edge

References num_incident_edges_.

platform::Size utility::graph::Node::num_neighbors_counting_self ( ) const
inline

the number of neighbors counting "self" as a neighbor.

References loop_incident_, and num_incident_edges_.

Referenced by add_edge(), and drop_edge().

platform::Size utility::graph::Node::num_neighbors_counting_self_static ( ) const
inline

the number of neighbors counting "self" as neighbor. Defaults to num_neighbors_counting_self() but can be set to other values as well. Useful in calculation of symmetrical structures.

References num_neighbors_counting_self_static_.

Node& utility::graph::Node::operator= ( Node )
private
void utility::graph::Node::print ( ) const
virtual

send summaray data about this node to the screen

virtual function to print node to standard out

References utility::graph::EdgeList::const_begin(), utility::graph::EdgeList::const_end(), and incident_edge_list_.

void utility::graph::Node::set_num_neighbors_counting_self_static ( platform::Size  neighbor)

manually change the number of neighbors for a Node. Used for symmetry scoring

References num_neighbors_counting_self_static_.

EdgeListIter utility::graph::Node::upper_edge_list_begin ( )
inline

returns a non-const iterator to the beginning of its upper-edge list

References first_upper_edge_.

EdgeListIter utility::graph::Node::upper_edge_list_end ( )
inline

returns a non-const iterator to the end of its upper-edge list

References utility::graph::EdgeList::end(), and incident_edge_list_.

Referenced by get_clash_pairs(), and has_clash().

Member Data Documentation

EdgeListIter utility::graph::Node::first_upper_edge_
private
EdgeList utility::graph::Node::incident_edge_list_
private
bool utility::graph::Node::loop_incident_
private
platform::Size utility::graph::Node::node_index_
private
platform::Size utility::graph::Node::num_edges_to_larger_indexed_nodes_
private
platform::Size utility::graph::Node::num_edges_to_smaller_indexed_nodes_
private

NOTE TO SELF: remove loop support.

Referenced by add_edge(), drop_edge(), and get_num_edges_to_smaller_indexed_nodes().

platform::Size utility::graph::Node::num_incident_edges_
private
platform::Size utility::graph::Node::num_neighbors_counting_self_static_
private
Graph* utility::graph::Node::owner_
private

Referenced by drop_all_edges(), and get_owner().


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