Trait IntoUndirectedGraph

Source
pub trait IntoUndirectedGraph {
    type UndirectedGraph: UndirectedGraph<Direction = Undirected>;

    // Required method
    fn to_undirected(&self) -> Self::UndirectedGraph;
}
Expand description

Convert to undirected graph trait.

Required Associated Types§

Source

type UndirectedGraph: UndirectedGraph<Direction = Undirected>

Associated undirected graph type.

Required Methods§

Source

fn to_undirected(&self) -> Self::UndirectedGraph

Make an undirected copy of the graph.

§Examples
use causal_hub::prelude::*;

// Build a directed graph.
let g = DiGraph::new(
    ["A", "B", "C"],
    [("A", "B")]
);

// Get an undirected copy.
let h = g.to_undirected();

// The undirected copy has the same vertex set.
assert_eq!(V!(g), V!(h));

// The vertices are still connected.
assert!(h.has_edge(0, 1));

Implementors§