pub struct DirectedGraph { /* private fields */ }

Implementations§

source§

impl DirectedGraph

source

pub fn empty(vertex_count: Vertex) -> Self

source

pub fn from_edges_iter<I>(vertex_count: Vertex, edges: I) -> Selfwhere I: Iterator<Item = (Vertex, Vertex)>,

source

pub fn from_dag(dag: &DirectedAcyclicGraph) -> Self

source

pub fn get_vertex_count(&self) -> Vertex

source

pub fn iter_edges(&self) -> impl Iterator<Item = (Vertex, Vertex)> + '_

source

pub fn get_edge(&self, parent: Vertex, child: Vertex) -> bool

source

pub fn set_edge(&mut self, parent: Vertex, child: Vertex, exists: bool)

source

pub fn find_tree_root(&self) -> Option<Vertex>

source

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.

source

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.

source

pub fn has_cycle(&self) -> bool

source

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.

source

pub fn iter_ancestors_dfs( &self, start_vertex: Vertex ) -> Box<dyn Iterator<Item = Vertex> + '_>

source

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.

source

pub fn get_descendants(&self) -> Vec<RoaringBitmap>

Computes a mapping: vertex -> set of vertices that are descendants of vertex.

source

pub fn transitive_reduction(&self) -> DirectedGraph

Returns a new DAG that is a transitive reduction of a DAG.

source

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.

source

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.

source

pub fn to_dot<W: Write>(&self, output: &mut W) -> Result<(), Error>

Outputs the DAG in the Graphviz DOT format.

source

pub fn to_dot_file<P: AsRef<Path>>(&self, path: P) -> Result<(), Error>

Trait Implementations§

source§

impl Clone for DirectedGraph

source§

fn clone(&self) -> DirectedGraph

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DirectedGraph

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V