pub trait ConnectivityAlgorithms<R: Runtime<DType = DType>> {
// 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§
Sourcefn connected_components(
&self,
graph: &GraphData<R>,
) -> Result<ComponentResult<R>>
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.
Sourcefn strongly_connected_components(
&self,
graph: &GraphData<R>,
) -> Result<ComponentResult<R>>
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.
Sourcefn is_connected(&self, graph: &GraphData<R>) -> Result<bool>
fn is_connected(&self, graph: &GraphData<R>) -> Result<bool>
Check if the graph is connected (undirected) or weakly connected (directed).
Sourcefn is_strongly_connected(&self, graph: &GraphData<R>) -> Result<bool>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".