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

pub trait Graph {
    fn is_empty(&self) -> bool;
fn order(&self) -> usize;
fn size(&self) -> usize;
fn nodes(&self) -> &[usize];
fn neighbors(&self, id: usize) -> Result<&[usize], Error>;
fn has_node(&self, id: usize) -> bool;
fn degree(&self, id: usize) -> Result<usize, Error>;
fn edges(&self) -> &[(usize, usize)];
fn has_edge(&self, sid: usize, tid: usize) -> Result<bool, Error>; }

An unweighted, undirected graph.

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(&self) -> &[usize]

Returns the nodes of this graph.

fn neighbors(&self, id: usize) -> Result<&[usize], Error>

Iterates the neighbors of the node. Returns an error if id not found.

fn has_node(&self, id: usize) -> bool

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

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

Returns the count of neighbors at node. REturns an error if id not found.

fn edges(&self) -> &[(usize, usize)]

Returns the edges of this graph.

fn has_edge(&self, sid: usize, tid: usize) -> Result<bool, Error>

Returns true if the edge (sid, tid) exists, or false otherwise. Returns MissingNode if either sid or tid are not members.

Loading content...

Implementors

impl Graph for ArrayGraph[src]

impl Graph for HashGraph[src]

Loading content...