TopologicalGraphAlgorithms

Trait TopologicalGraphAlgorithms 

Source
pub trait TopologicalGraphAlgorithms<N, W>: GraphView<N, W> {
    // Required methods
    fn find_cycle(&self) -> Result<Option<Vec<usize>>, GraphError>;
    fn has_cycle(&self) -> Result<bool, GraphError>;
    fn topological_sort(&self) -> Result<Option<Vec<usize>>, GraphError>;
}

Required Methods§

Source

fn find_cycle(&self) -> Result<Option<Vec<usize>>, GraphError>

Finds a single cycle in the graph and returns the path of nodes that form it.

Source

fn has_cycle(&self) -> Result<bool, GraphError>

Checks if the graph contains any directed cycles. This method should be implemented as a simple call to self.find_cycle().is_some().

Source

fn topological_sort(&self) -> Result<Option<Vec<usize>>, GraphError>

Computes a topological sort of the graph, if it is a Directed Acyclic Graph (DAG). Returns None if the graph contains a cycle.

Implementors§

Source§

impl<N, W> TopologicalGraphAlgorithms<N, W> for CsmGraph<N, W>
where N: Clone, W: Clone + Default,

Source§

impl<N, W> TopologicalGraphAlgorithms<N, W> for UltraGraphContainer<N, W>
where N: Clone, W: Clone + Default,