Trait petgraph::data::Build
[−]
[src]
pub trait Build: Data + NodeCount { fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId; fn update_edge(&mut self, a: Self::NodeId, b: Self::NodeId, weight: Self::EdgeWeight) -> Self::EdgeId; fn add_edge(&mut self, a: Self::NodeId, b: Self::NodeId, weight: Self::EdgeWeight) -> Option<Self::EdgeId> { ... } }
A graph that can be extended with further nodes and edges
Required Methods
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId
fn update_edge(&mut self, a: Self::NodeId, b: Self::NodeId, weight: Self::EdgeWeight) -> Self::EdgeId
Add or update the edge from a
to b
. Return the id of the affected
edge.
Provided Methods
fn add_edge(&mut self, a: Self::NodeId, b: Self::NodeId, weight: Self::EdgeWeight) -> Option<Self::EdgeId>
Add a new edge. If parallel edges (duplicate) are not allowed and
the edge already exists, return None
.