Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
|
Generic representation of a directed acyclic graph. More...
#include <Directed_acyclic_graph.hpp>
Public Types | |
enum | Orientation_type |
Orientation of the edges in the Directed Acyclic Graph. More... | |
typedef boost::adjacency_list< boost::listS, boost::listS, boost::bidirectionalS, VertexProperty, EdgeProperty > | Graph |
Representation of the Directed Acyclic Graph as a adjacency_list of the Boost Graph Library. More... | |
typedef Graph_traits::vertex_descriptor | Vertex |
Representation of a Vertex of the Directed Acyclic Graph. More... | |
typedef Graph_traits::edge_descriptor | Edge |
Representation of an Edge of the Directed Acyclic Graph. More... | |
typedef Graph_traits::vertex_iterator | Vertices_iterator |
Iterator over all the vertices of the Directed Acyclic Graph. More... | |
typedef Graph_traits::edge_iterator | Edges_iterator |
Iterator over all the edges of the Directed Acyclic Graph. More... | |
typedef boost::transform_iterator< Get_parent_from_edge, In_edges_iterator > | Parents_iterator |
Iterator over all the parents of a given Vertex. More... | |
typedef boost::transform_iterator< Get_child_from_edge, Out_edges_iterator > | Children_iterator |
Iterator over all the children of a given Vertex. More... | |
typedef boost::filter_iterator< Is_maximal_element, Vertices_iterator > | Maximal_elements_iterator |
Iterator over the vertices of the Directed Acyclic Graph that are maximal elements of the corresponding partially ordered set. More... | |
typedef boost::filter_iterator< Is_minimal_element, Vertices_iterator > | Minimal_elements_iterator |
Iterator over the vertices of the Directed Acyclic Graph that are minimal elements of the corresponding partially ordered set. More... | |
Constructors | |
T_Directed_acyclic_graph (Orientation_type orientation=MAXIMAL_ROOT_ORIENTATION) | |
Default constructor creating an empty Directed Acyclic Graph. More... | |
Graph | |
const Graph & | get_graph (void) const |
Const Access to the BGL graph. More... | |
Graph & | get_graph (void) |
Acces to the BGL graph. More... | |
void | clear (void) |
Vertices | |
unsigned | get_number_of_vertices (void) const |
Access to the number of vertices in the graph. More... | |
VertexProperty & | operator[] (Vertex v) |
Access to the property associated to a vertex. More... | |
const VertexProperty & | operator[] (Vertex v) const |
Const access to the property associated to a vertex. More... | |
bool | is_empty (void) const |
Check that the graph has no vertex. More... | |
template<class Comparator , class DataType , class OutputIterator > | |
OutputIterator | find_vertices_compared_to_data (const DataType &data, OutputIterator out, const Comparator &compare=Comparator()) const |
Find all the vertices in the graph having a property that compares equal to the input data. More... | |
template<class Comparator , class DataType > | |
bool | find_first_vertex_compared_to_data (const DataType &data, Vertex &v, const Comparator &compare=Comparator()) const |
Find the first vertex in the graph having a property that compares equal to the input data. More... | |
Vertex | add_vertex (void) |
Add a vertex with no property to the graph. More... | |
Vertex | add_vertex (const VertexProperty &p) |
Add a vertex with the property p to the graph. More... | |
void | remove_vertex (Vertex v) |
Remove the vertex v from the graph. More... | |
Vertices_iterator | vertices_begin (void) const |
Starts the set of vertices of the graph. More... | |
Vertices_iterator | vertices_end (void) const |
Ends the set of vertices of the graph. More... | |
Edges | |
unsigned | get_number_of_edges (void) const |
Access to the number of edges in the graph. More... | |
Edge | get_edge (Vertex u, Vertex v) const |
EdgeProperty & | operator[] (Edge e) |
Access to the property attached to e. More... | |
const EdgeProperty & | operator[] (Edge e) const |
Const access to the property attached to e. More... | |
Edge | add_edge (Vertex u, Vertex v) |
Add an edge from u to v, with no property. More... | |
Edge | add_edge (Vertex u, Vertex v, const EdgeProperty &p) |
Add an edge from u to v, with the property p. More... | |
void | clear_vertex (Vertex v) |
Remove all edges incident to v. More... | |
void | remove_edge (Vertex u, Vertex v) |
Remove the edge from u to v. More... | |
void | remove_edge (Edge e) |
Remove the edge e from the graph. More... | |
Edges_iterator | edges_begin () const |
Starts the set of edges. More... | |
Edges_iterator | edges_end () const |
Ends the set of edges. More... | |
Parent / Child | |
unsigned | get_number_of_parents (Vertex v) const |
Access to the number of parents of v. More... | |
unsigned | get_number_of_children (Vertex v) const |
Access to the number of children of v. More... | |
Vertex | get_parent (Edge e) const |
Access to the source of e. More... | |
Vertex | get_child (Edge e) const |
Access to the target of e. More... | |
bool | is_parent (Vertex u, Vertex v) const |
Check that u is a parent of v. More... | |
bool | is_ancestor (Vertex u, Vertex v) const |
Check that u is an ancestor of v. More... | |
void | clear_children (Vertex v) |
Remove all out-going edges incident to v. More... | |
void | clear_parents (Vertex v) |
Remove all in-going edges incident to v. More... | |
Children_iterator | children_begin (Vertex v) const |
Starts the set of children of v. More... | |
Children_iterator | children_end (Vertex v) const |
Ends the set of children of v. More... | |
Parents_iterator | parents_begin (Vertex v) const |
Starts the set of parents of v. More... | |
Parents_iterator | parents_end (Vertex v) const |
Ends the set of parents of v. More... | |
Minimal / Maximal Elements | |
template<class OutputIterator > | |
OutputIterator | get_minimal_elements_from (Vertex v, OutputIterator out) const |
Access to the set of minimal elements lower or equal to v. More... | |
template<class OutputIterator > | |
OutputIterator | get_maximal_elements_from (Vertex v, OutputIterator out) const |
Access to the set of maximal elements greater or equal to v. More... | |
const Orientation_type & | get_orientation (void) const |
Return the orientation of the DAG. More... | |
Orientation_type & | get_orientation (void) |
Return a reference to the orientation of the DAG. More... | |
bool | is_maximal_root_oriented (void) const |
Check that maximal elements are the roots of the graph. More... | |
bool | is_minimal_element (Vertex u) const |
Check that u is a minimal element. More... | |
bool | is_maximal_element (Vertex u) const |
Check that u is a maximal element. More... | |
bool | is_lower (Vertex u, Vertex v) const |
Check that u is lower than v. More... | |
Maximal_elements_iterator | maximal_elements_begin () const |
Starts the set of maximal elements. More... | |
Maximal_elements_iterator | maximal_elements_end () const |
Ends the set of maximal elements. More... | |
Minimal_elements_iterator | minimal_elements_begin () const |
Starts the set of minimal elements. More... | |
Minimal_elements_iterator | minimal_elements_end () const |
Ends the set of minimal elements. More... | |
Partial Order Set Builder | |
template<class PartialOrderPredicate , class InputIterator > | |
void | build_from_partially_ordered_set (InputIterator begin, InputIterator end, const PartialOrderPredicate &order=PartialOrderPredicate()) |
Construct the Directed Acyclic Graph from the partially ordered set in [begin, end). More... | |
Subgraph Manipulators | |
template<class InputIterator , class OutputIterator > | |
OutputIterator | get_induced_subgraph (InputIterator begin, InputIterator end, OutputIterator out) const |
Construct the induced subgraph from the range of vertices in [begin, end). More... | |
template<class OutputIterator > | |
OutputIterator | get_descendant_ancestor_subgraph (Vertex u, Vertex v, OutputIterator out) const |
Construct the maximal subgraph such that all vertices are ancestors of u and descendants of v. More... | |
template<class VertexIterator , class EdgeIterator > | |
void | get_subgraph (VertexIterator v_begin, VertexIterator v_end, EdgeIterator e_begin, EdgeIterator e_end, Self &subgraph) const |
Construct the subgraph from the range of vertices [v_begin, v_end) and edges in [e_begin, e_end). More... | |
template<class InputIterator > | |
void | get_edge_subgraph (InputIterator begin, InputIterator end, Self &subgraph) const |
Construct the edge subgraph from the range of edges in [begin, end). More... | |
I/O | |
template<class OutputStream > | |
void | print_in_dot_format (OutputStream &out) const |
Print in the output stream the graph in DOT format. More... | |
void | print_in_dot_format (void) const |
Print in the standard output stream the graph in DOT format. More... | |
Generic representation of a directed acyclic graph.
It implements a bidirectional adjacency_list from the Boost Graph Library that uses lists for storing the vertices and the out-going edges. The T_Directed_acyclic_graph class provides:
VertexProperty | Information attached to the vertices (default is Directed_acyclic_graph_default_property). |
EdgeProperty | Information attached to the edges (default is Directed_acyclic_graph_default_property). |
typedef boost::transform_iterator<Get_child_from_edge, Out_edges_iterator> Children_iterator |
Iterator over all the children of a given Vertex.
typedef Graph_traits::edge_descriptor Edge |
Representation of an Edge of the Directed Acyclic Graph.
typedef Graph_traits::edge_iterator Edges_iterator |
Iterator over all the edges of the Directed Acyclic Graph.
typedef boost::adjacency_list<boost::listS, boost::listS, boost::bidirectionalS, VertexProperty, EdgeProperty> Graph |
Representation of the Directed Acyclic Graph as a adjacency_list of the Boost Graph Library.
Note that the containers for vertices and out edges are both lists for supoprting the removal.
typedef boost::filter_iterator<Is_maximal_element, Vertices_iterator> Maximal_elements_iterator |
Iterator over the vertices of the Directed Acyclic Graph that are maximal elements of the corresponding partially ordered set.
typedef boost::filter_iterator<Is_minimal_element, Vertices_iterator> Minimal_elements_iterator |
Iterator over the vertices of the Directed Acyclic Graph that are minimal elements of the corresponding partially ordered set.
typedef boost::transform_iterator<Get_parent_from_edge, In_edges_iterator> Parents_iterator |
Iterator over all the parents of a given Vertex.
typedef Graph_traits::vertex_descriptor Vertex |
Representation of a Vertex of the Directed Acyclic Graph.
typedef Graph_traits::vertex_iterator Vertices_iterator |
Iterator over all the vertices of the Directed Acyclic Graph.
enum Orientation_type |
Orientation of the edges in the Directed Acyclic Graph.
Options are:
|
inline |
Default constructor creating an empty Directed Acyclic Graph.
orientation | defines the orientation of the edges. |
|
inline |
Add an edge from u to v, with no property.
|
inline |
Add an edge from u to v, with the property p.
|
inline |
Add a vertex with the property p to the graph.
|
inline |
Add a vertex with no property to the graph.
|
inline |
Construct the Directed Acyclic Graph from the partially ordered set in [begin, end).
The input order predicate is used as a partial order. Each element of the set is represented by a vertex in the Directed Acyclic Graph. There is an edge from a vertex u to a vertex v if v is compared less than u with the partial order, and if there is no other vertex w such that v is less than w and w is less than u. Note that each element has to be unique (i.e multiplicity is not allowed).
begin | Starts the set of elements of the partially ordered set. |
end | Ends the set of elements of the partially ordered set. |
order | Functor representing a partial ordering over the elements in [begin, end). |
|
inline |
Starts the set of children of v.
|
inline |
Ends the set of children of v.
|
inline |
Remove all out-going edges incident to v.
|
inline |
Remove all in-going edges incident to v.
|
inline |
Remove all edges incident to v.
|
inline |
Starts the set of edges.
|
inline |
Ends the set of edges.
|
inline |
Find the first vertex in the graph having a property that compares equal to the input data.
Note that there is no order on the vertices, so if there are several vertices having properties comparing equal to the input data, only an arbitrary one is found.
data | Data to be compared with the properties of the vertices. |
v | Vertex with a property that compares equal to data, if any. |
compare | Comparator between the data and the properties of vertices. |
|
inline |
Find all the vertices in the graph having a property that compares equal to the input data.
data | Data to be compared with the properties of the vertices. |
out | Output iterator over a container of vertices. |
compare | Comparator between the data and the properties of vertices. |
|
inline |
Access to the target of e.
|
inline |
Construct the maximal subgraph such that all vertices are ancestors of u and descendants of v.
u | The descendant. |
v | The ancestor. |
out | Output iterator over a set of edges. |
|
inline |
Access to the Edge u -> v.
|
inline |
Construct the edge subgraph from the range of edges in [begin, end).
begin | Starts the set of edges. |
end | Ends the set of edges. |
subgraph | The output edge subgraph. |
|
inline |
Acces to the BGL graph.
|
inline |
Const Access to the BGL graph.
|
inline |
Construct the induced subgraph from the range of vertices in [begin, end).
begin | Starts the set of vertices. |
end | Ends the set of vertices. |
out | Output iterator over a set of edges. |
|
inline |
Access to the set of maximal elements greater or equal to v.
|
inline |
Access to the set of minimal elements lower or equal to v.
|
inline |
Access to the number of children of v.
|
inline |
Access to the number of edges in the graph.
|
inline |
Access to the number of parents of v.
|
inline |
Access to the number of vertices in the graph.
|
inline |
Return a reference to the orientation of the DAG.
|
inline |
Return the orientation of the DAG.
|
inline |
Access to the source of e.
|
inline |
Construct the subgraph from the range of vertices [v_begin, v_end) and edges in [e_begin, e_end).
v_begin | Starts the set of vertices. |
v_end | Ends the set of vertices. |
e_begin | Starts the set of edges. |
e_end | Ends the set of edges. |
subgraph | The output subgraph. |
|
inline |
Check that the graph has no vertex.
|
inline |
Check that u is a maximal element.
|
inline |
Check that maximal elements are the roots of the graph.
|
inline |
Check that u is a minimal element.
|
inline |
Starts the set of maximal elements.
|
inline |
Ends the set of maximal elements.
|
inline |
Starts the set of minimal elements.
|
inline |
Ends the set of minimal elements.
|
inline |
Access to the property attached to e.
|
inline |
Const access to the property attached to e.
|
inline |
Access to the property associated to a vertex.
|
inline |
Const access to the property associated to a vertex.
|
inline |
Starts the set of parents of v.
|
inline |
Ends the set of parents of v.
void print_in_dot_format | ( | OutputStream & | out | ) | const |
Print in the output stream the graph in DOT format.
void print_in_dot_format | ( | void | ) | const |
Print in the standard output stream the graph in DOT format.
|
inline |
Remove the edge e from the graph.
|
inline |
Remove the vertex v from the graph.
|
inline |
Starts the set of vertices of the graph.
|
inline |
Ends the set of vertices of the graph.