Trait graph_rs::DirectedWeightedGraph [] [src]

pub trait DirectedWeightedGraph<'g, N, W> where
    N: 'g + Eq,
    W: 'g, 
{ type AllWeightedEdges: Iterator<Item = (&'g N, &'g N, &'g W)>; type AllWeightedEdgesMut: Iterator<Item = (&'g N, &'g N, &'g mut W)>; fn all_edges(&'g self) -> Self::AllWeightedEdges;
fn all_edges_mut(&'g mut self) -> Self::AllWeightedEdgesMut;
fn add_edge(&'g mut self, _: N, _: N, _: W) -> Option<(N, N, W)>;
fn remove_edge(&'g mut self, _: &N, _: &N) -> Option<(N, N, W)>; fn has_edge(&'g self, source: &N, sink: &N) -> bool { ... }
fn edge_weight(&'g self, source: &N, sink: &N) -> Option<&W> { ... }
fn edge_weight_mut(&'g mut self, source: &N, sink: &N) -> Option<&mut W> { ... } }

A directed graph with edge weights. The efficiency of the different operations is highly dependent on the backend used.

Associated Types

An iterator that iterates over all edges.

An iterator that iterates over all edges, giving mutable access to the weight.

Required Methods

Returns an iterator over all the edges in this graph.

Returns an iterator over all the ediges in this graph, with mutable access to the weight.

Adds an edge to this graph.

Removes an edge from the graph.

Provided Methods

Checks if a graph has an edge or not.

Complexity

The default implementation runs in O(|E|) time.

Gets a borrow to the weight of the requested edge, if it exist.

Complexity

The default implementation runs in O(|E|).

Gets a mutable borrow to the weight of the requested edge, if it exist.

Complexity

The default implementation runs in O(|E|) time.

Implementors