Struct roaring_graphs::digraph::DirectedGraph
source · pub struct DirectedGraph { /* private fields */ }Implementations§
source§impl DirectedGraph
impl DirectedGraph
pub fn empty(vertex_count: Vertex) -> Self
pub fn from_edges_iter<I>(vertex_count: Vertex, edges: I) -> Selfwhere I: Iterator<Item = (Vertex, Vertex)>,
pub fn from_dag(dag: &DirectedAcyclicGraph) -> Self
pub fn get_vertex_count(&self) -> Vertex
pub fn iter_edges(&self) -> impl Iterator<Item = (Vertex, Vertex)> + '_
pub fn get_edge(&self, parent: Vertex, child: Vertex) -> bool
pub fn set_edge(&mut self, parent: Vertex, child: Vertex, exists: bool)
pub fn find_tree_root(&self) -> Option<Vertex>
sourcepub fn extend_with_children(&self, children: &mut Vec<Vertex>, u: Vertex)
pub fn extend_with_children(&self, children: &mut Vec<Vertex>, u: Vertex)
Iterates over vertices v such that there’s an edge (u, v) in the graph.
sourcepub fn extend_with_parents(&self, parents: &mut Vec<Vertex>, v: Vertex)
pub fn extend_with_parents(&self, parents: &mut Vec<Vertex>, v: Vertex)
Iterates over vertices u such that there’s an edge (u, v) in the graph.
pub fn has_cycle(&self) -> bool
sourcepub fn iter_descendants_dfs(
&self,
start_vertex: Vertex
) -> Box<dyn Iterator<Item = Vertex> + '_>
pub fn iter_descendants_dfs( &self, start_vertex: Vertex ) -> Box<dyn Iterator<Item = Vertex> + '_>
Visit all vertices reachable from vertex in a depth-first-search (DFS)
order.
pub fn iter_ancestors_dfs( &self, start_vertex: Vertex ) -> Box<dyn Iterator<Item = Vertex> + '_>
sourcepub fn get_vertices_without_incoming_edges(&self) -> Vec<Vertex>
pub fn get_vertices_without_incoming_edges(&self) -> Vec<Vertex>
Returns a set “seed” vertices of a DAG from which a traversal may start so that the process covers all vertices in the graph.
sourcepub fn get_descendants(&self) -> Vec<RoaringBitmap>
pub fn get_descendants(&self) -> Vec<RoaringBitmap>
Computes a mapping: vertex -> set of vertices that are descendants of vertex.
sourcepub fn transitive_reduction(&self) -> DirectedGraph
pub fn transitive_reduction(&self) -> DirectedGraph
Returns a new DAG that is a transitive reduction of a DAG.
sourcepub fn iter_vertices_dfs_post_order(
&self
) -> Box<dyn Iterator<Item = Vertex> + '_>
pub fn iter_vertices_dfs_post_order( &self ) -> Box<dyn Iterator<Item = Vertex> + '_>
Visit all vertices of a DAG in a depth-first-search postorder, i.e. emitting vertices only after all their descendants have been emitted first.
sourcepub fn iter_edges_dfs_post_order(
&self
) -> Box<dyn Iterator<Item = (Vertex, Vertex)> + '_>
pub fn iter_edges_dfs_post_order( &self ) -> Box<dyn Iterator<Item = (Vertex, Vertex)> + '_>
Visit nodes in a depth-first-search (DFS) emitting edges in postorder, i.e. each node after all its descendants have been emitted.
Note that when a DAG represents a partially ordered
set, this function iterates over pairs of
that poset. It may be necessary to first compute either a Self::transitive_reduction of a
DAG, to only get the minimal set of pairs spanning the entire poset.
sourcepub fn to_dot<W: Write>(&self, output: &mut W) -> Result<(), Error>
pub fn to_dot<W: Write>(&self, output: &mut W) -> Result<(), Error>
Outputs the DAG in the Graphviz DOT format.
pub fn to_dot_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>
Trait Implementations§
source§impl Clone for DirectedGraph
impl Clone for DirectedGraph
source§fn clone(&self) -> DirectedGraph
fn clone(&self) -> DirectedGraph
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more