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.

Implementations on Foreign Types§

source§

impl<'g, G> IndexGraph for &'g Gwhere 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,