Generic representation of a directed acyclic graph with layers.
More...
#include <Directed_acyclic_graph_with_layers.hpp>
|
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...
|
|
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...
|
|
Vertex | add_vertex (unsigned height) |
| Add a vertex with no property in the graph, at a height h. More...
|
|
Vertex | add_vertex (const VertexProperty &p, unsigned height) |
| Add a vertex with a property p in the graph, at a height h. More...
|
|
void | remove_vertex (Vertex v) |
| Remove the vertex v from the graph. More...
|
|
|
template<class PartialOrderPredicate , class InputIterator > |
void | build_from_partially_ordered_set (InputIterator begin, InputIterator end, const PartialOrderPredicate &order) |
| Construct the Directed Acyclic Graph from the partially ordered set in [begin, end). More...
|
|
|
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...
|
|
|
template<class OutputStream > |
void | print_in_dot_format (OutputStream &out, bool enforced_rank=true) const |
| Print in the output stream the graph in DOT format. More...
|
|
void | print_in_dot_format (bool enforced_rank=true) const |
| Print in the standard output stream the graph in DOT format. More...
|
|
|
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...
|
|
void | get_edge_subgraph (InputIterator begin, InputIterator end, Self &subgraph) const |
| Construct the edge subgraph from the range of edges in [begin, end). More...
|
|
template<class VertexProperty = Directed_acyclic_graph_default_property, class EdgeProperty = Directed_acyclic_graph_default_property>
class SBL::CADS::T_Directed_acyclic_graph_with_layers< VertexProperty, EdgeProperty >
Generic representation of a directed acyclic graph with layers.
It inherits from the T_Directed_acyclic_graph class, and add a layer representation to the data structure. The T_Directed_acyclic_graph_with_layers class provides:
- manipulators for the layers,
- overloaded methods from the base class.
- Template Parameters
-
◆ Children_iterator
Iterator over all the children of a given Vertex.
◆ Edge
Representation of an Edge of the Directed Acyclic Graph.
◆ Edges_iterator
Iterator over all the edges of the Directed Acyclic Graph.
◆ 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.
◆ Layer
Representation of a layer of the graph.
◆ Layer_iterator
Iterator over all the vertices of a given layer.
◆ Maximal_elements_iterator
Iterator over the vertices of the Directed Acyclic Graph that are maximal elements of the corresponding partially ordered set.
◆ Minimal_elements_iterator
Iterator over the vertices of the Directed Acyclic Graph that are minimal elements of the corresponding partially ordered set.
◆ Orientation_type
Orientation of the edges in the Directed Acyclic Graph.
Options are:
- MAXIMAL_ROOT_ORIENTATION : the roots are the maximal elements of the Directed Acyclic Graph.
- MINIMAL_ROOT_ORIENTATION : the roots are the minimal elements of the Directed Acyclic Graph.
◆ Parents_iterator
Iterator over all the parents of a given Vertex.
◆ Vertex
Representation of a Vertex of the Directed Acyclic Graph.
◆ Vertices_iterator
Iterator over all the vertices of the Directed Acyclic Graph.
◆ T_Directed_acyclic_graph_with_layers()
Default constructor creating an empty directed acyclic graph with no layer.
- Parameters
-
orientation | defines the orientation of the edges. |
◆ add_edge() [1/2]
Add an edge from u to v, with no property.
- Precondition
- get_height(u) != get_height(v).
-
get_height(u) > get_height(v) iff the graph is maximal root oriented.
◆ add_edge() [2/2]
Add an edge from u to v, with the property p.
- Precondition
- get_height(u) != get_height(v).
-
get_height(u) > get_height(v) iff the graph is maximal root oriented.
◆ add_vertex() [1/2]
◆ add_vertex() [2/2]
◆ build_from_partially_ordered_set()
void build_from_partially_ordered_set |
( |
InputIterator |
begin, |
|
|
InputIterator |
end, |
|
|
const PartialOrderPredicate & |
order |
|
) |
| |
|
inline |
Construct the Directed Acyclic Graph from the partially ordered set in [begin, end).
The range [begin, end) defines a set of pairs (height, element) allowing to associate an height to each element of the partially ordered set. Note that each element has to be unique (i.e multiplicity is not allowed).
- Precondition
- get_height(u) != get_height(v).
-
get_height(u) > get_height(v) iff the graph is maximal root oriented.
◆ children_begin()
Starts the set of children of v.
◆ children_end()
Ends the set of children of v.
◆ clear_children()
void clear_children |
( |
Vertex |
v | ) |
|
|
inline |
Remove all out-going edges incident to v.
◆ clear_parents()
void clear_parents |
( |
Vertex |
v | ) |
|
|
inline |
Remove all in-going edges incident to v.
◆ clear_vertex()
Remove all edges incident to v.
◆ edges_begin()
◆ edges_end()
◆ find_first_vertex_compared_to_data()
bool find_first_vertex_compared_to_data |
( |
const DataType & |
data, |
|
|
Vertex & |
v, |
|
|
const Comparator & |
compare = Comparator() |
|
) |
| const |
|
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.
- Parameters
-
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. |
- Returns
- true iff a vertex was found.
◆ find_vertices_compared_to_data()
OutputIterator find_vertices_compared_to_data |
( |
const DataType & |
data, |
|
|
OutputIterator |
out, |
|
|
const Comparator & |
compare = Comparator() |
|
) |
| const |
|
inline |
Find all the vertices in the graph having a property that compares equal to the input data.
- Parameters
-
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. |
◆ get_child()
Access to the target of e.
◆ get_descendant_ancestor_subgraph()
OutputIterator get_descendant_ancestor_subgraph |
( |
Vertex |
u, |
|
|
Vertex |
v, |
|
|
OutputIterator |
out |
|
) |
| const |
|
inline |
Construct the maximal subgraph such that all vertices are ancestors of u and descendants of v.
- Parameters
-
u | The descendant. |
v | The ancestor. |
out | Output iterator over a set of edges. |
◆ get_edge()
Access to the Edge u -> v.
- Precondition
- u is a parent of v.
◆ get_edge_subgraph() [1/2]
void get_edge_subgraph |
( |
InputIterator |
begin, |
|
|
InputIterator |
end, |
|
|
Self & |
subgraph |
|
) |
| const |
|
inlineinherited |
Construct the edge subgraph from the range of edges in [begin, end).
- Parameters
-
begin | Starts the set of edges. |
end | Ends the set of edges. |
subgraph | The output edge subgraph. |
◆ get_edge_subgraph() [2/2]
void get_edge_subgraph |
( |
InputIterator |
begin, |
|
|
InputIterator |
end, |
|
|
Self & |
subgraph |
|
) |
| const |
|
inline |
Construct the edge subgraph from the range of edges in [begin, end).
- Parameters
-
begin | Starts the set of edges. |
end | Ends the set of edges. |
subgraph | The output edge subgraph. |
◆ get_graph() [1/2]
◆ get_graph() [2/2]
Const Access to the BGL graph.
◆ get_height()
unsigned get_height |
( |
Vertex |
v | ) |
const |
|
inline |
Access to the height of a vertex.
- Precondition
- The vertex has a height.
◆ get_induced_subgraph()
OutputIterator get_induced_subgraph |
( |
InputIterator |
begin, |
|
|
InputIterator |
end, |
|
|
OutputIterator |
out |
|
) |
| const |
|
inline |
Construct the induced subgraph from the range of vertices in [begin, end).
- Parameters
-
begin | Starts the set of vertices. |
end | Ends the set of vertices. |
out | Output iterator over a set of edges. |
◆ get_maximal_elements_from()
OutputIterator get_maximal_elements_from |
( |
Vertex |
v, |
|
|
OutputIterator |
out |
|
) |
| const |
|
inlineinherited |
Access to the set of maximal elements greater or equal to v.
◆ get_minimal_elements_from()
OutputIterator get_minimal_elements_from |
( |
Vertex |
v, |
|
|
OutputIterator |
out |
|
) |
| const |
|
inlineinherited |
Access to the set of minimal elements lower or equal to v.
◆ get_number_of_children()
unsigned get_number_of_children |
( |
Vertex |
v | ) |
const |
|
inline |
Access to the number of children of v.
◆ get_number_of_edges()
unsigned get_number_of_edges |
( |
void |
| ) |
const |
|
inline |
Access to the number of edges in the graph.
◆ get_number_of_layers()
unsigned get_number_of_layers |
( |
void |
| ) |
const |
|
inline |
Access to the number of layers in the graph.
◆ get_number_of_parents()
unsigned get_number_of_parents |
( |
Vertex |
v | ) |
const |
|
inline |
Access to the number of parents of v.
◆ get_number_of_vertices() [1/2]
unsigned get_number_of_vertices |
( |
unsigned |
height | ) |
const |
|
inline |
Access to the number of vertices with the input height.
◆ get_number_of_vertices() [2/2]
unsigned get_number_of_vertices |
( |
void |
| ) |
const |
|
inline |
Access to the number of vertices in the graph.
◆ get_orientation() [1/2]
Return a reference to the orientation of the DAG.
◆ get_orientation() [2/2]
Return the orientation of the DAG.
◆ get_parent()
Access to the source of e.
◆ get_subgraph() [1/2]
void get_subgraph |
( |
VertexIterator |
v_begin, |
|
|
VertexIterator |
v_end, |
|
|
EdgeIterator |
e_begin, |
|
|
EdgeIterator |
e_end, |
|
|
Self & |
subgraph |
|
) |
| const |
|
inlineinherited |
Construct the subgraph from the range of vertices [v_begin, v_end) and edges in [e_begin, e_end).
- Parameters
-
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. |
◆ get_subgraph() [2/2]
void get_subgraph |
( |
VertexIterator |
v_begin, |
|
|
VertexIterator |
v_end, |
|
|
EdgeIterator |
e_begin, |
|
|
EdgeIterator |
e_end, |
|
|
Self & |
subgraph |
|
) |
| const |
|
inline |
Construct the subgraph from the range of vertices [v_begin, v_end) and edges in [e_begin, e_end).
- Parameters
-
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. |
◆ has_height()
bool has_height |
( |
Vertex |
v | ) |
const |
|
inline |
Return true if v is an associated height.
◆ increment_maximal_height()
unsigned increment_maximal_height |
( |
unsigned |
k = 1 | ) |
|
|
inline |
Increment the maximal height by adding k layers.
- Precondition
- k > 0.
◆ is_ancestor()
Check that u is an ancestor of v.
In particular, if the height of u is lower or equal to the height of v, it returns false.
◆ is_empty()
bool is_empty |
( |
void |
| ) |
const |
|
inline |
Check that the graph has no vertex.
◆ is_lower()
Check that u is lower than v.
◆ is_maximal_element()
bool is_maximal_element |
( |
Vertex |
u | ) |
const |
|
inlineinherited |
Check that u is a maximal element.
◆ is_maximal_root_oriented()
bool is_maximal_root_oriented |
( |
void |
| ) |
const |
|
inlineinherited |
Check that maximal elements are the roots of the graph.
◆ is_minimal_element()
bool is_minimal_element |
( |
Vertex |
u | ) |
const |
|
inlineinherited |
Check that u is a minimal element.
◆ is_parent()
Check that u is a parent of v.
◆ layer_begin()
Starts the set of vertices (possibly empty) with the input height.
◆ layer_end()
Ends the set of vertices (possibly empty) with the input height.
◆ maximal_elements_begin()
Starts the set of maximal elements.
◆ maximal_elements_end()
Ends the set of maximal elements.
◆ minimal_elements_begin()
Starts the set of minimal elements.
◆ minimal_elements_end()
Ends the set of minimal elements.
◆ operator[]() [1/4]
EdgeProperty & operator[] |
( |
Edge |
e | ) |
|
|
inline |
Access to the property attached to e.
◆ operator[]() [2/4]
const EdgeProperty & operator[] |
( |
Edge |
e | ) |
const |
|
inline |
Const access to the property attached to e.
◆ operator[]() [3/4]
VertexProperty & operator[] |
( |
Vertex |
v | ) |
|
|
inline |
Access to the property associated to a vertex.
◆ operator[]() [4/4]
const VertexProperty & operator[] |
( |
Vertex |
v | ) |
const |
|
inline |
Const access to the property associated to a vertex.
◆ parents_begin()
Starts the set of parents of v.
◆ parents_end()
Ends the set of parents of v.
◆ print_in_dot_format() [1/4]
void print_in_dot_format |
( |
bool |
enforced_rank = true | ) |
const |
|
inline |
Print in the standard output stream the graph in DOT format.
◆ print_in_dot_format() [2/4]
void print_in_dot_format |
( |
OutputStream & |
out | ) |
const |
|
inherited |
Print in the output stream the graph in DOT format.
◆ print_in_dot_format() [3/4]
void print_in_dot_format |
( |
OutputStream & |
out, |
|
|
bool |
enforced_rank = true |
|
) |
| const |
|
inline |
Print in the output stream the graph in DOT format.
◆ print_in_dot_format() [4/4]
void print_in_dot_format |
( |
void |
| ) |
const |
|
inherited |
Print in the standard output stream the graph in DOT format.
◆ remove_edge() [1/2]
void remove_edge |
( |
Edge |
e | ) |
|
|
inline |
Remove the edge e from the graph.
◆ remove_edge() [2/2]
Remove the edge from u to v.
◆ remove_vertex()
void remove_vertex |
( |
Vertex |
v | ) |
|
|
inline |
Remove the vertex v from the graph.
It also removes v from its layer.
◆ set_dot_graph_vertex_label()
void set_dot_graph_vertex_label |
( |
std::string |
vlabel | ) |
|
|
inline |
◆ vertices_begin()
Starts the set of vertices of the graph.
◆ vertices_end()
Ends the set of vertices of the graph.