Structural Bioinformatics Library
Template C++ / Python API for developping structural bioinformatics applications.
|
Authors: F. Cazals and T.Dreyfus
A partial order is a relation which is reflexive, antisymmetric, and transitive. A set equipped with a partial order is called a partially ordered set, and can be represented by a Directed Acyclic Graph (DAG).
Each element of this set is represented by a vertex of the DAG. If there is a directed edge from u to v, then we say u is a parent of v and v is a child of u. If there is a directed path from u to v, we say u is an ancestor of v and v is descendant of u.
Consider two vertices u and v with u v. Note that there are two options for the semantics of the directed edge between u and v in the DAG:
By default, the DAG is maximal-root oriented, but it can be reverted to the minimal-root orientation one thanks to a tag in the class.
A layered DAG is a DAG such that each vertex is also endowed with an integer starting at 0, which we call a height in the sequel. The vertices having the same height are grouped onto layers, inducing a partition of the vertices of the layered DAG.
This package provides classes representing a DAG and a layered DAG. For each class, the construction can be done in two ways:
A functor is also provided for printing the DAG and the layered DAG in a Dot file, allowing the user to visualize it with the Graphviz software (see Graphviz homepage ).
The main class is SBL::CADS::T_Directed_acyclic_graph < VertexProperty , EdgeProperty >, and relies upon an adjacency graph from the Boost Graph Library (BGL) (see the BGL adjacency_list user manual ). The two template parameters of the SBL::CADS::T_Directed_acyclic_graph class are two template parameters of the BGL adjacency_list, the other ones being fixed :
Note that default properties are provided for both vertices and edges when no particular data has to be attached.
The fixed template parameters are:
An example is provided in the Directed_acyclic_graph example section.
The class SBL::CADS::T_Directed_acyclic_graph_with_layers < VertexProperty , EdgeProperty >, inherits from SBL::CADS::T_Directed_acyclic_graph, and implements the layered DAG data structure.
Note that the layer based structure modifies the behavior of several overloaded methods, ad mentioned in the reference manual of SBL::CADS::T_Directed_acyclic_graph_with_layers. An example is provided in the Directed_acyclic_graph_with_layers example section.
Finally, the class SBL::CADS::T_Directed_acyclic_graph_dot_output < VertexProperty , EdgeProperty > allows to print into an output stream both data structures in the Dot format.
This package has no internal dependency.
The only external dependency is the Boost library, for the graph representation (BGL library) and for customized iterators over vertices and edges of the DAG (Boost.Iterator library). Note that these two Boost libraries are generic and consist only of C++ header files.
Note also that for visualizing a DAG in Dot format, one should install Graphviz (see Graphviz homepage ).
Following the two construction modes mentioned in the Introduction, this section provides two examples to build a DAG:
This example presents the SBL::CADS::T_Directed_acyclic_graph < VertexProperty , EdgeProperty > class. A DAG is built from the partially ordered set of the example 1, and then printed in Dot format. Note that the DAG is maximal-root oriented, meaning that the largest sets of integers or at the roots of the DAG.
This example presents the SBL::CADS::T_Directed_acyclic_graph_with_layers < VertexProperty , EdgeProperty >. Let a protein complex consists of a set of protein types, a type being represented by a string. In a protein complex, the protein types are sorted by the lexicographic order. We consider the partial order on the set of protein complexes defined by the strict inclusion: .
The example loads a set of protein complexes from an input file, constructs the layered DAG of this set, where the height of a protein complex is the number of proteins it contains. Finally, the corresponding graph is printed on the standard output in the Dot file format. Note that the DAG is maximal-root oriented, meaning that the largest sets of proteins or at the roots of the DAG.