Trait IndexGraph

Source
pub trait IndexGraph: Graph {
    // Required methods
    fn node_id(&self, u: Self::Node<'_>) -> usize;
    fn id2node(&self, id: usize) -> Self::Node<'_>;
    fn edge_id(&self, e: Self::Edge<'_>) -> usize;
    fn id2edge(&self, id: usize) -> Self::Edge<'_>;
}
Expand description

Associates nodes and edges with unique ids.

Required Methods§

Source

fn node_id(&self, u: Self::Node<'_>) -> usize

Return a unique id associated with a node.

Source

fn id2node(&self, id: usize) -> Self::Node<'_>

Return the node associated with the given id.

The method panics if the id is invalid.

Source

fn edge_id(&self, e: Self::Edge<'_>) -> usize

Return a unique id associated with an edge.

The returned id is the same for the edge and its reverse edge.

Source

fn id2edge(&self, id: usize) -> Self::Edge<'_>

Return the edge associated with the given id.

The method returns the forward edge.

The method panics if the id is invalid.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<'g, G> IndexGraph for &'g G
where G: IndexGraph,

Source§

fn node_id(&self, u: Self::Node<'_>) -> usize

Source§

fn edge_id(&self, e: Self::Edge<'_>) -> usize

Source§

fn id2node(&self, id: usize) -> Self::Node<'_>

Source§

fn id2edge(&self, id: usize) -> Self::Edge<'_>

Source§

impl<G> IndexGraph for Rc<G>
where G: IndexGraph,

Source§

fn node_id(&self, u: Self::Node<'_>) -> usize

Source§

fn edge_id(&self, e: Self::Edge<'_>) -> usize

Source§

fn id2node(&self, id: usize) -> Self::Node<'_>

Source§

fn id2edge(&self, id: usize) -> Self::Edge<'_>

Implementors§

Source§

impl<'g, G> IndexGraph for Network<'g, G>
where G: IndexGraph,

Source§

impl<'g, G> IndexGraph for ReverseDigraph<'g, G>
where G: IndexGraph,

Source§

impl<ID> IndexGraph for VecGraph<ID>
where ID: PrimInt + Unsigned + 'static,

Source§

impl<ID, N, E> IndexGraph for LinkedListGraph<ID, N, E>
where ID: PrimInt + Unsigned + 'static,