pub struct AdjacencyListFlowGraph<N = ()>{ /* private fields */ }Expand description
An adapter for petgraph::Graph to be used as a FlowGraph and OriginalGraphView.
This graph is directed. Edge weights are f64 representing capacities.
Node weights are generic (N), defaulting to ().
It assumes that vertex indices used by algorithms (usize) correspond directly to
petgraph::NodeIndex::index() values. This holds if nodes are added and not removed.
Implementations§
Source§impl<N> AdjacencyListFlowGraph<N>
impl<N> AdjacencyListFlowGraph<N>
Sourcepub fn add_edge(&mut self, u_idx: usize, v_idx: usize, capacity: f64)
pub fn add_edge(&mut self, u_idx: usize, v_idx: usize, capacity: f64)
Adds a directed edge to the graph.
§Arguments
u_idx: Theusizeindex of the source node (previously returned byadd_node).v_idx: Theusizeindex of the target node (previously returned byadd_node).capacity: The capacity of the edge (must bef64).
§Panics
Panics if u_idx or v_idx do not correspond to existing nodes in the graph,
or if they are out of bounds for the current node count.
petgraph itself panics if NodeIndexs are invalid.
Trait Implementations§
Source§impl<N> Clone for AdjacencyListFlowGraph<N>
impl<N> Clone for AdjacencyListFlowGraph<N>
Source§fn clone(&self) -> AdjacencyListFlowGraph<N>
fn clone(&self) -> AdjacencyListFlowGraph<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<N> Debug for AdjacencyListFlowGraph<N>
impl<N> Debug for AdjacencyListFlowGraph<N>
Source§impl<N> Default for AdjacencyListFlowGraph<N>
Default implementation for AdjacencyListFlowGraph.
Creates an empty graph. Requires N to implement Default.
impl<N> Default for AdjacencyListFlowGraph<N>
Default implementation for AdjacencyListFlowGraph.
Creates an empty graph. Requires N to implement Default.
Source§impl<N> FlowGraph for AdjacencyListFlowGraph<N>
Implements FlowGraph for AdjacencyListFlowGraph.
impl<N> FlowGraph for AdjacencyListFlowGraph<N>
Implements FlowGraph for AdjacencyListFlowGraph.
Source§fn vertex_count(&self) -> usize
fn vertex_count(&self) -> usize
Returns the number of vertices in the graph.
Source§impl<N> OriginalGraphView for AdjacencyListFlowGraph<N>
Implements OriginalGraphView for AdjacencyListFlowGraph.
impl<N> OriginalGraphView for AdjacencyListFlowGraph<N>
Implements OriginalGraphView for AdjacencyListFlowGraph.