Trait IndexGraphRef

Source
pub trait IndexGraphRef<'a>: UndirectedRef<'a> {
    // 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

A reference to an indexed graph.

This trait contains methods with a unrestricted lifetime for self.

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<'a, G> IndexGraphRef<'a> for &'a 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<'a, G> IndexGraphRef<'a> for NonNull<G>
where G: IndexGraph + 'a,

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<'a, G> IndexGraphRef<'a> for Network<'a, G>
where G: IndexGraph,

Source§

impl<'a, G> IndexGraphRef<'a> for ReverseDigraph<'a, G>
where G: IndexGraphRef<'a>,