Skip to main content

ConnectivityAlgorithms

Trait ConnectivityAlgorithms 

Source
pub trait ConnectivityAlgorithms<R: Runtime> {
    // Required methods
    fn connected_components(
        &self,
        graph: &GraphData<R>,
    ) -> Result<ComponentResult<R>>;
    fn strongly_connected_components(
        &self,
        graph: &GraphData<R>,
    ) -> Result<ComponentResult<R>>;
    fn is_connected(&self, graph: &GraphData<R>) -> Result<bool>;
    fn is_strongly_connected(&self, graph: &GraphData<R>) -> Result<bool>;
}
Expand description

Graph connectivity algorithms.

Determines connected components and connectivity properties.

Required Methods§

Source

fn connected_components( &self, graph: &GraphData<R>, ) -> Result<ComponentResult<R>>

Find connected components of an undirected graph.

Uses BFS-based label propagation. Each node gets labeled with its component ID (smallest node index in the component).

For directed graphs, treats edges as undirected.

Source

fn strongly_connected_components( &self, graph: &GraphData<R>, ) -> Result<ComponentResult<R>>

Find strongly connected components of a directed graph.

Uses Tarjan’s algorithm (sequential DFS-based). For undirected graphs, equivalent to connected_components.

Source

fn is_connected(&self, graph: &GraphData<R>) -> Result<bool>

Check if the graph is connected (undirected) or weakly connected (directed).

Source

fn is_strongly_connected(&self, graph: &GraphData<R>) -> Result<bool>

Check if the directed graph is strongly connected.

Every node is reachable from every other node.

Implementations on Foreign Types§

Source§

impl ConnectivityAlgorithms<CpuRuntime> for CpuClient

Implementors§