Skip to main content

Biconnectivity

Struct Biconnectivity 

Source
pub struct Biconnectivity { /* private fields */ }
Expand description

The bridges, articulation points and biconnected components of a graph read as undirected, as components::biconnectivity_of returns them.

A bridge is an edge whose removal increases the number of connected components, and an articulation point is a node whose removal does the same. A biconnected component, also called a block, is a maximal group of edges in which any two edges lie on a common cycle. The blocks partition the edges, not the nodes: an articulation point belongs to every block it touches.

The graph is read as undirected, as described at components: the edges a -> b and b -> a are one undirected edge. So a graph that stores its edges in both directions still has bridges, and the two directions of an edge lie in the same block. Self-loops are in no block and never a bridge. Here, the control flow of the method load, whose loop is connected to the rest only through header:

let biconnectivity = components::biconnectivity_of(&BiAdjacentGraph::of(&cfg));
let bridges = biconnectivity.bridges();
// bridges: entry -> header, header -> exit
let articulation_points = biconnectivity.articulation_points();
// articulation_points: [1] - header

Instances are immutable and safe to share between threads (Send and Sync).

Memory: up to 8 x edge_count + 20 x node_count bytes.

Implementations§

Source§

impl Biconnectivity

Source

pub fn bridges(&self) -> &Edges

Returns the bridges, in edge index order.

Of a bridge stored in both directions, only the edge from the lower to the higher node ID is listed; blocks puts the other direction in the same block.

Time: O(1).

Source

pub fn articulation_points(&self) -> SortedIntView<'_>

Returns the articulation points, in ascending order.

Time: O(1).

Source

pub fn blocks(&self) -> &EdgePartition

Returns the blocks, as a partition of the edges.

Each block is a group of the partition: blocks().get(e) returns the block of edge e, and blocks().edges_of(block) the edges of a block. Self-loops are in no block and map to None, so is_partial returns true exactly if the graph has self-loops. Which block gets which group ID is not specified, but the same graph always yields the same group IDs.

Time: O(1).

Trait Implementations§

Source§

impl Clone for Biconnectivity

Source§

fn clone(&self) -> Biconnectivity

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Biconnectivity

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 T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.