Rosetta
Classes | Typedefs | Functions | Variables
utility::graph Namespace Reference

Classes

class  Array0
 Class Array0 is a c-style array wrapper that does bounds checking in debug mode. It indexes from 0 just like regular c-arrays. Class Array0 does not manage it's own memory. It does not allocate memory if you want to make it larger, nor does it deallocate memory when you destroy it. Bounds checking only ensures that the user does not go outside of the memory Array0 thinks it's in charge of. If the user should happen to point the array0 at memory that has not been allocated, Array0 is not responsible for segmentation fault that will likely occur. Garbage in, garbage out. More...
 
class  NegSpaceElement
 NegSpaceElement represents a single element in the singly-linked list of negative space in an array pool. More...
 
class  ArrayPoolElement
 
class  ArrayPool
 
class  EXCN_Stop_BFS
 Class to raise to do an immediate stop of a breadth first search. ONLY THROW FROM WITHIN A VISITOR PASSED TO breadth_first_visit_prune/breadth_first_search_prune. More...
 
class  null_bfs_prune_visitor
 
class  HideVertexVisitor
 
class  DirectedEdgeListElement
 An extensible directed graph class. More...
 
class  DirectedEdgeListIterator
 Custom DirectedEdge list (non-const) iterator class, which can return non-const DirectedEdge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. The former workaround to this problem was to define two sets of edge lists on each vertex: a list< DirectedEdge * > and a list< DirectedEdge const * >. More...
 
class  DirectedEdgeListConstIterator
 Custom DirectedEdge list const iterator class, which returns only const DirectedEdge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. More...
 
class  DirectedEdgeList
 Custom edge list class. Returns const-iterators which only return DirectedEdge const *'s and non-const-iterators which can return either const or non-const DirectedEdge*'s. Manages its own memory using an unordered-object-pool for fast insertion and deletion of DirectedEdgeListElements. Implemented as a doubly linked list, though there's no practical way to start at the end of a list and work backward since decrementing the end iterator is not a valid operation. More...
 
class  DirectedNode
 
class  DirectedEdge
 
class  Digraph
 A Digraph with constant time edge insertion and deletion. Extensible. More...
 
struct  DS_Node
 
class  DisjointSets
 
class  EdgeListElement
 An extensible graph class. More...
 
class  EdgeListIterator
 Custom Edge list (non-const) iterator class, which can return non-const Edge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. The former workaround to this problem was to define two sets of edge lists on each vertex: a list< Edge * > and a list< Edge const * >. More...
 
class  EdgeListConstIterator
 Custom Edge list const iterator class, which returns only const Edge pointers. This iterator cannot be used to change the structure of its list without access to that list directly. Customized since STL's const-iterator cannot be prevented from giving non-const access to its data. The former workaround to this problem was to define two sets of edge lists on each vertex: a list< Edge * > and a list< Edge const * >. More...
 
class  EdgeList
 Custom edge list class. Returns const-iterators which only return Edge const *'s and non-const-iterators which can return either const or non-const Edge*'s. Manages its own memory using an unordered-object-pool for fast insertion and deletion of EdgeListElements. Implemented as a doubly linked list, though there's no practical way to start at the end of a list and work backward since decrementing the end iterator is not a valid operation. More...
 
class  Node
 
class  Edge
 
class  Graph
 A Graph with constant time edge insertion and deletion. Extensible. More...
 
class  LowMemGraph
 A graph with low memory use and constant time edge insertion. Extensible. @detail For general use, use utility::graph::DefaultLowMemGraph. More...
 
class  LowMemEdgeListIter
 Non-const iterator for edges. More...
 
class  LowMemEdgeListConstIter
 Const iterator for edges. More...
 
class  LowMemNode
 An Node class for LowMemGraph. Will often be overriden @detail Be careful with this class! It doesn't use actual virtual functions. Never do this: LowMemNodeOP op = MyDerivedNodeOP() Instead, if you wish to use an owning pointer, you must do this: MyDerivedNodeOP op = MyDerivedNodeOP() More...
 
class  LowMemEdge
 An Edge class for LowMemGraph. Will often be overriden. @detail Be careful with this class! It doesn't use actual virtual functions. Never do this: LowMemEdgeOP op = MyDerivedEdgeOP() Instead, if you wish to use an owning pointer, you must do this: MyDerivedEdgeOP op = MyDerivedEdgeOP() More...
 
class  LowMemGraphBase
 Pure virtual baseclass that was required to avoid templating Edges and Nodes. More...
 
class  RingSizeVisitor
 A class to implement the behavior of the smallest ring size finding algorithm, accessible through the smallest_ring_size() function below. More...
 
class  RingEdgeAnnotationVisitor
 
class  RingDetection
 basic chemical Bond More...
 
class  UEVertex
 
class  UEEdge
 
class  UpperEdgeGraph
 

Typedefs

typedef utility::pointer::shared_ptr< ArrayPool< platform::Real > > RealArrayPoolOP
 
typedef utility::pointer::shared_ptr< ArrayPool< platform::Real > const > RealArrayPoolCOP
 
typedef utility::pointer::shared_ptr< DigraphDigraphOP
 
typedef utility::pointer::shared_ptr< Digraph const > DigraphCOP
 
typedef utility::pointer::shared_ptr< GraphGraphOP
 
typedef utility::pointer::shared_ptr< Graph const > GraphCOP
 
typedef LowMemGraph< LowMemNode, LowMemEdgeDefaultLowMemGraph
 
typedef utility::pointer::shared_ptr< DefaultLowMemGraphDefaultLowMemGraphOP
 
typedef utility::pointer::shared_ptr< DefaultLowMemGraph const > DefaultLowMemGraphCOP
 

Functions

std::string neg_space_element_allocation_error_message (platform::Size block_size, platform::Size neg_space_element_size)
 
std::string block_allocation_error_message (platform::Size block_size, platform::Size array_size, platform::Size t_size)
 
template<class IncidenceGraph , class Buffer , class BFSVisitor , class ColorMap >
void breadth_first_visit_prune (const IncidenceGraph &g, typename boost::graph_traits< IncidenceGraph >::vertex_descriptor s, BFSVisitor vis, ColorMap color, Buffer &Q)
 breadth_first_visit_prune is a slightly modified version of the Boost function breadth_first_visit, allowing the visitor class to prune nodes and edges. See breadth_first_search_prune for details More...
 
template<class IncidenceGraph , class BFSVisitor , class ColorMap >
void breadth_first_visit_prune (const IncidenceGraph &, typename boost::graph_traits< IncidenceGraph >::vertex_descriptor s, BFSVisitor vis, ColorMap color)
 
template<class VertexListGraph , class Buffer , class BFSVisitor , class ColorMap >
void breadth_first_search_prune (const VertexListGraph &g, typename boost::graph_traits< VertexListGraph >::vertex_descriptor s, BFSVisitor vis, ColorMap color, Buffer &Q)
 breadth_first_search_prune is a slightly modified versions of the Boost functions breadth_first_search allowing the visitor class to prune nodes and edges. More...
 
template<class VertexListGraph , class BFSVisitor , class ColorMap >
void breadth_first_search_prune (const VertexListGraph &g, typename boost::graph_traits< VertexListGraph >::vertex_descriptor s, BFSVisitor vis, ColorMap color)
 
template<class VertexListGraph , class BFSVisitor >
void breadth_first_search_prune (const VertexListGraph &g, typename boost::graph_traits< VertexListGraph >::vertex_descriptor s, BFSVisitor vis)
 
template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void depth_first_visit_sort_impl (const IncidenceGraph &g, typename boost::graph_traits< IncidenceGraph >::vertex_descriptor u, DFSVisitor &vis, ColorMap color, SortFunc const &func)
 depth_first_visit_sort_impl is a slightly modified version of the recursive version of the Boost function depth_first_visit_impl, allowing the visitor class to prune nodes and edges. See depth_first_search_sort for details More...
 
template<class VertexListGraph , class DFSVisitor , class ColorMap , class SortFunc >
void depth_first_search_sort (const VertexListGraph &g, DFSVisitor vis, ColorMap color, typename boost::graph_traits< VertexListGraph >::vertex_descriptor start_vertex, SortFunc const &func)
 A sorted depth first search. The parameter func should be a callable object which takes two graph edge descriptors, and returns true if the first should go before the second in ordering. More...
 
template<class VertexListGraph , class DFSVisitor , class ColorMap , class SortFunc >
void depth_first_search_sort (const VertexListGraph &g, DFSVisitor vis, ColorMap color, SortFunc const &func)
 A sorted depth first search. The parameter func should be a callable object which takes two graph edge descriptors, and returns true if the first should go before the second in ordering. More...
 
template<class VertexListGraph , class SortFunc , class P , class T , class R >
void depth_first_search_sort (const VertexListGraph &g, SortFunc const &func, const boost::bgl_named_params< P, T, R > &params)
 Named Parameter Variant. More...
 
template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void depth_first_visit (const IncidenceGraph &g, typename boost::graph_traits< IncidenceGraph >::vertex_descriptor u, DFSVisitor vis, ColorMap color, SortFunc const &func)
 
template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void depth_first_visit (const IncidenceGraph &g, typename boost::graph_traits< IncidenceGraph >::vertex_descriptor u, DFSVisitor vis, ColorMap color, SortFunc func=SortFunc())
 
void visit (Digraph const &g, platform::Size node_index, utility::vector1< platform::Size > &visited_status, std::list< platform::Size > &toposort_order, bool &is_DAG)
 
platform::Size find_unmarked_node (utility::vector1< platform::Size > &visited_status, platform::Size last_descend_from)
 
std::pair< std::list< platform::Size >, bool > topological_sort (Digraph const &g)
 Construct a topological sort for the input directed graph, if it is a DAG, and return whether or not the input graph is actually a DAG. More...
 
bool digraph_is_a_DAG (Digraph const &g)
 Return whether or not the input directed graph is a DAG – this invokes the topological_sort function and simply returns the second element in the pair that it returns. More...
 
bool all_visited (utility::vector1< bool > const &visited)
 
utility::vector1< std::pair< platform::Size, platform::Size > > find_connected_components (Graph const &g)
 returns a vector1 of connected component descriptions: each entry holds a representative vertex from that connected component (first entry in pair) and the connected-component size (second entry in pair). O( V+E ). More...
 
void delete_all_intragroup_edges (Graph &g, utility::vector1< platform::Size > const &node_groups)
 
template<class Graph >
platform::Size smallest_ring_size (typename boost::graph_traits< Graph >::vertex_descriptor const &vd, Graph const &graph, platform::Size const &max_ring_size=2 *999999)
 A boost graph-based function to find the size of the smallest ring for a given vertex. Will return the maximum ring size, or 999999 for no ring. If there is a maximum ring size, That can be set to limit the amount of search needed. More...
 
template<class Graph >
std::map< typename boost::graph_traits< Graph >::vertex_descriptor, std::map< typename boost::graph_traits< Graph >::vertex_descriptor, bool > > annotate_ring_edges (Graph &graph)
 

Variables

platform::Size const NOT_VISITED = 0
 
platform::Size const TEMPORARY_VISITED = 1
 
platform::Size const VISITED = 2
 
bool output_interaction_graph_memory_usage = false
 

Typedef Documentation

◆ DefaultLowMemGraph

◆ DefaultLowMemGraphCOP

typedef utility::pointer::shared_ptr< DefaultLowMemGraph const > utility::graph::DefaultLowMemGraphCOP

◆ DefaultLowMemGraphOP

typedef utility::pointer::shared_ptr< DefaultLowMemGraph > utility::graph::DefaultLowMemGraphOP

◆ DigraphCOP

typedef utility::pointer::shared_ptr< Digraph const > utility::graph::DigraphCOP

◆ DigraphOP

typedef utility::pointer::shared_ptr< Digraph > utility::graph::DigraphOP

◆ GraphCOP

typedef utility::pointer::shared_ptr< Graph const > utility::graph::GraphCOP

◆ GraphOP

typedef utility::pointer::shared_ptr< Graph > utility::graph::GraphOP

◆ RealArrayPoolCOP

typedef utility::pointer::shared_ptr< ArrayPool< platform::Real > const > utility::graph::RealArrayPoolCOP

◆ RealArrayPoolOP

typedef utility::pointer::shared_ptr< ArrayPool< platform::Real > > utility::graph::RealArrayPoolOP

Function Documentation

◆ all_visited()

bool utility::graph::all_visited ( utility::vector1< bool > const &  visited)

References create_a3b_hbs::ii.

Referenced by find_connected_components().

◆ annotate_ring_edges()

template<class Graph >
std::map< typename boost::graph_traits<Graph>::vertex_descriptor, std::map< typename boost::graph_traits<Graph>::vertex_descriptor, bool > > utility::graph::annotate_ring_edges ( Graph graph)

◆ block_allocation_error_message()

std::string utility::graph::block_allocation_error_message ( platform::Size  block_size,
platform::Size  array_size,
platform::Size  t_size 
)

◆ breadth_first_search_prune() [1/3]

template<class VertexListGraph , class BFSVisitor >
void utility::graph::breadth_first_search_prune ( const VertexListGraph &  g,
typename boost::graph_traits< VertexListGraph >::vertex_descriptor  s,
BFSVisitor  vis 
)

◆ breadth_first_search_prune() [2/3]

template<class VertexListGraph , class BFSVisitor , class ColorMap >
void utility::graph::breadth_first_search_prune ( const VertexListGraph &  g,
typename boost::graph_traits< VertexListGraph >::vertex_descriptor  s,
BFSVisitor  vis,
ColorMap  color 
)

◆ breadth_first_search_prune() [3/3]

template<class VertexListGraph , class Buffer , class BFSVisitor , class ColorMap >
void utility::graph::breadth_first_search_prune ( const VertexListGraph &  g,
typename boost::graph_traits< VertexListGraph >::vertex_descriptor  s,
BFSVisitor  vis,
ColorMap  color,
Buffer &  Q 
)

breadth_first_search_prune is a slightly modified versions of the Boost functions breadth_first_search allowing the visitor class to prune nodes and edges.

Note the calling order is slightly different (and has to be explicit), as I didn't want to recapitulate the boost frontend magic.

It assumes all of the relevant functions in the visitor class return bools, with the following meanings:

vis.initialize_vertex(u, g) – return value ignored vis.discover_vertex(u, g); – if true, don't add vertex to queue (but still mark as grey) vis.examine_vertex(u, g); – if true, don't examine any out edges for vertex (but still mark black) vis.examine_edge(e, g); – if true, ignore edge (don't follow) vis.tree_edge(e, g); – if true, ignore discovered vertex (don't mark as grey) vis.non_tree_edge(e, g); – if true, don't bother with black/grey function calls vis.gray_target(e, g); – return value ignored vis.black_target(e, g); – return value ignored vis.finish_vertex(u, g); – return value ignored

Any of the above functions can throw a EXCN_Stop_BFS exception, which will immediately halt the search.

References breadth_first_visit_prune(), test.T009_Exceptions::e, g(), create_a3b_hbs::i, docking::Q, and docking::s.

Referenced by smallest_ring_size().

◆ breadth_first_visit_prune() [1/2]

template<class IncidenceGraph , class BFSVisitor , class ColorMap >
void utility::graph::breadth_first_visit_prune ( const IncidenceGraph &  ,
typename boost::graph_traits< IncidenceGraph >::vertex_descriptor  s,
BFSVisitor  vis,
ColorMap  color 
)

◆ breadth_first_visit_prune() [2/2]

template<class IncidenceGraph , class Buffer , class BFSVisitor , class ColorMap >
void utility::graph::breadth_first_visit_prune ( const IncidenceGraph &  g,
typename boost::graph_traits< IncidenceGraph >::vertex_descriptor  s,
BFSVisitor  vis,
ColorMap  color,
Buffer &  Q 
)

breadth_first_visit_prune is a slightly modified version of the Boost function breadth_first_visit, allowing the visitor class to prune nodes and edges. See breadth_first_search_prune for details

References subloop_histogram::black, test.T009_Exceptions::e, g(), ObjexxFCL::get(), docking::Q, docking::s, basic::options::OptionKeys::hotspot::target, kmeans_adaptive_kernel_density_bb_dependent_rotlib::u, and kmeans_adaptive_kernel_density_bb_dependent_rotlib::v.

Referenced by breadth_first_search_prune(), and breadth_first_visit_prune().

◆ delete_all_intragroup_edges()

void utility::graph::delete_all_intragroup_edges ( Graph g,
utility::vector1< platform::Size > const &  node_groups 
)

References debug_assert, and g().

◆ depth_first_search_sort() [1/3]

template<class VertexListGraph , class DFSVisitor , class ColorMap , class SortFunc >
void utility::graph::depth_first_search_sort ( const VertexListGraph &  g,
DFSVisitor  vis,
ColorMap  color,
SortFunc const &  func 
)

A sorted depth first search. The parameter func should be a callable object which takes two graph edge descriptors, and returns true if the first should go before the second in ordering.

This version will start at an arbitrary vertex, and restart for disconnected portions of the graph

References depth_first_search_sort(), func, and g().

◆ depth_first_search_sort() [2/3]

template<class VertexListGraph , class DFSVisitor , class ColorMap , class SortFunc >
void utility::graph::depth_first_search_sort ( const VertexListGraph &  g,
DFSVisitor  vis,
ColorMap  color,
typename boost::graph_traits< VertexListGraph >::vertex_descriptor  start_vertex,
SortFunc const &  func 
)

A sorted depth first search. The parameter func should be a callable object which takes two graph edge descriptors, and returns true if the first should go before the second in ordering.

This version will start at start_vertex, but will restart arbitrarily for any disconnected graph portions.

References depth_first_visit_sort_impl(), create_a3b_hbs::first, func, g(), ObjexxFCL::get(), and kmeans_adaptive_kernel_density_bb_dependent_rotlib::u.

Referenced by depth_first_search_sort(), and reroot_restype().

◆ depth_first_search_sort() [3/3]

template<class VertexListGraph , class SortFunc , class P , class T , class R >
void utility::graph::depth_first_search_sort ( const VertexListGraph &  g,
SortFunc const &  func,
const boost::bgl_named_params< P, T, R > &  params 
)

◆ depth_first_visit() [1/2]

template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void utility::graph::depth_first_visit ( const IncidenceGraph &  g,
typename boost::graph_traits< IncidenceGraph >::vertex_descriptor  u,
DFSVisitor  vis,
ColorMap  color,
SortFunc const &  func 
)

◆ depth_first_visit() [2/2]

template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void utility::graph::depth_first_visit ( const IncidenceGraph &  g,
typename boost::graph_traits< IncidenceGraph >::vertex_descriptor  u,
DFSVisitor  vis,
ColorMap  color,
SortFunc  func = SortFunc() 
)

◆ depth_first_visit_sort_impl()

template<class IncidenceGraph , class DFSVisitor , class ColorMap , class SortFunc >
void utility::graph::depth_first_visit_sort_impl ( const IncidenceGraph &  g,
typename boost::graph_traits< IncidenceGraph >::vertex_descriptor  u,
DFSVisitor &  vis,
ColorMap  color,
SortFunc const &  func 
)

depth_first_visit_sort_impl is a slightly modified version of the recursive version of the Boost function depth_first_visit_impl, allowing the visitor class to prune nodes and edges. See depth_first_search_sort for details

References subloop_histogram::black, func, g(), ObjexxFCL::get(), subloop_histogram::iterator, basic::options::OptionKeys::hotspot::target, kmeans_adaptive_kernel_density_bb_dependent_rotlib::u, and kmeans_adaptive_kernel_density_bb_dependent_rotlib::v.

Referenced by depth_first_search_sort(), and depth_first_visit().

◆ digraph_is_a_DAG()

bool utility::graph::digraph_is_a_DAG ( Digraph const &  g)

Return whether or not the input directed graph is a DAG – this invokes the topological_sort function and simply returns the second element in the pair that it returns.

References g(), and topological_sort().

◆ find_connected_components()

utility::vector1< std::pair< platform::Size, platform::Size > > utility::graph::find_connected_components ( Graph const &  g)

returns a vector1 of connected component descriptions: each entry holds a representative vertex from that connected component (first entry in pair) and the connected-component size (second entry in pair). O( V+E ).

DFS search to identify connected components O(V) memory, O(V+E) time.

References all_visited(), utility::graph::Node::const_edge_list_begin(), utility::graph::Node::const_edge_list_end(), debug_assert, g(), and create_a3b_hbs::ii.

◆ find_unmarked_node()

platform::Size utility::graph::find_unmarked_node ( utility::vector1< platform::Size > &  visited_status,
platform::Size  last_descend_from 
)

References create_a3b_hbs::ii, and NOT_VISITED.

Referenced by topological_sort().

◆ neg_space_element_allocation_error_message()

std::string utility::graph::neg_space_element_allocation_error_message ( platform::Size  block_size,
platform::Size  neg_space_element_size 
)

◆ smallest_ring_size()

template<class Graph >
platform::Size utility::graph::smallest_ring_size ( typename boost::graph_traits< Graph >::vertex_descriptor const &  vd,
Graph const &  graph,
platform::Size const &  max_ring_size = 2*999999 
)

A boost graph-based function to find the size of the smallest ring for a given vertex. Will return the maximum ring size, or 999999 for no ring. If there is a maximum ring size, That can be set to limit the amount of search needed.

References breadth_first_search_prune().

◆ topological_sort()

std::pair< std::list< platform::Size >, bool > utility::graph::topological_sort ( Digraph const &  g)

Construct a topological sort for the input directed graph, if it is a DAG, and return whether or not the input graph is actually a DAG.

References find_unmarked_node(), g(), NOT_VISITED, and visit().

Referenced by digraph_is_a_DAG().

◆ visit()

void utility::graph::visit ( Digraph const &  g,
platform::Size  node_index,
utility::vector1< platform::Size > &  visited_status,
std::list< platform::Size > &  toposort_order,
bool &  is_DAG 
)

Variable Documentation

◆ NOT_VISITED

platform::Size const utility::graph::NOT_VISITED = 0

◆ output_interaction_graph_memory_usage

bool utility::graph::output_interaction_graph_memory_usage = false

◆ TEMPORARY_VISITED

platform::Size const utility::graph::TEMPORARY_VISITED = 1

Referenced by visit().

◆ VISITED

platform::Size const utility::graph::VISITED = 2

Referenced by visit().