[][src]Trait gamma::graph::Graph

pub trait Graph<'a, N: 'a> {
    type NodeIterator: Iterator<Item = &'a N>;
    type NeighborIterator: Iterator<Item = &'a N>;
    type EdgeIterator: Iterator<Item = (&'a N, &'a N)>;
    fn is_empty(&self) -> bool;
fn order(&self) -> usize;
fn size(&self) -> usize;
fn nodes(&'a self) -> Self::NodeIterator;
fn has_node(&self, node: &N) -> bool;
fn neighbors(&'a self, node: &N) -> Result<Self::NeighborIterator, Error>;
fn degree(&self, node: &N) -> Result<usize, Error>;
fn edges(&'a self) -> Self::EdgeIterator;
fn has_edge(&self, source: &N, target: &N) -> Result<bool, Error>; }

An undirected graph.

Associated Types

Loading content...

Required methods

fn is_empty(&self) -> bool

Returns true if there are no nodes, or false otherwise.

fn order(&self) -> usize

Returns the number of nodes in this graph.

fn size(&self) -> usize

Returns the number of edges in this graph.

fn nodes(&'a self) -> Self::NodeIterator

Iterates the nodes of this graph

fn has_node(&self, node: &N) -> bool

Returns true if node is a member, or false otherwise.

fn neighbors(&'a self, node: &N) -> Result<Self::NeighborIterator, Error>

Iterates the neighbors of node.

fn degree(&self, node: &N) -> Result<usize, Error>

Returns the number of neighbors connected to node.

fn edges(&'a self) -> Self::EdgeIterator

Iterates the edges of this graph.

fn has_edge(&self, source: &N, target: &N) -> Result<bool, Error>

Returns true if an edge exists between source and target.

Loading content...

Implementors

impl<'a> Graph<'a, usize> for IndexGraph[src]

type NodeIterator = Iter<'a, usize>

type NeighborIterator = Iter<'a, usize>

type EdgeIterator = EdgeIterator<'a>

impl<'a, N: 'a + Eq + Hash> Graph<'a, N> for Matching<N>[src]

type NodeIterator = Iter<'a, N>

type NeighborIterator = NeighborIterator<'a, N>

type EdgeIterator = Iter<'a, N, N>

impl<'a, N: 'a + Hash + Eq + Clone> Graph<'a, N> for HashGraph<N>[src]

type NodeIterator = Keys<'a, N, Vec<N>>

type NeighborIterator = Iter<'a, N>

type EdgeIterator = EdgeIterator<'a, N>

impl<'a, N: 'a + Hash + Eq, E: 'a> Graph<'a, N> for StableGraph<N, E>[src]

type NodeIterator = Iter<'a, N>

type NeighborIterator = NeighborIterator<'a, N, E>

type EdgeIterator = EdgeIterator<'a, N>

Loading content...