Trait petgraph::data::Build [−][src]
A graph that can be extended with further nodes and edges
Required methods
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId[src]
fn update_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId[src]
&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>[src]
&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.
Implementors
impl<E, Ix: IndexType> Build for List<E, Ix>[src]
fn add_node(&mut self, _weight: ()) -> NodeIndex<Ix>[src]
Adds a new node to the list. This allocates a new Vec and then should
run in amortized O(1) time.
fn add_edge(
&mut self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>,
weight: E
) -> Option<EdgeIndex<Ix>>[src]
&mut self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>,
weight: E
) -> Option<EdgeIndex<Ix>>
Add an edge from a to b to the graph, with its associated
data weight.
Return the index of the new edge.
Computes in O(1) time.
Panics if the source node does not exist.
Note: List allows adding parallel (“duplicate”) edges. If you want
to avoid this, use .update_edge(a, b, weight) instead.
fn update_edge(
&mut self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>,
weight: E
) -> EdgeIndex<Ix>[src]
&mut self,
a: NodeIndex<Ix>,
b: NodeIndex<Ix>,
weight: E
) -> EdgeIndex<Ix>
Updates or adds an edge from a to b to the graph, with its associated
data weight.
Return the index of the new edge.
Computes in O(e') time, where e' is the number of successors of a.
Panics if the source node does not exist.
impl<N, E, Ty> Build for GraphMap<N, E, Ty> where
Ty: EdgeType,
N: NodeTrait, [src]
Ty: EdgeType,
N: NodeTrait,
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId[src]
fn add_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>
fn update_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId
impl<N, E, Ty, Ix> Build for Graph<N, E, Ty, Ix> where
Ty: EdgeType,
Ix: IndexType, [src]
Ty: EdgeType,
Ix: IndexType,
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId[src]
fn add_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>
fn update_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId
impl<N, E, Ty, Ix> Build for StableGraph<N, E, Ty, Ix> where
Ty: EdgeType,
Ix: IndexType, [src]
Ty: EdgeType,
Ix: IndexType,
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId[src]
fn add_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>
fn update_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId
impl<N, E, Ty: EdgeType, Null: Nullable<Wrapped = E>, Ix: IndexType> Build for MatrixGraph<N, E, Ty, Null, Ix>[src]
fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId[src]
fn add_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Option<Self::EdgeId>
fn update_edge(
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId[src]
&mut self,
a: Self::NodeId,
b: Self::NodeId,
weight: Self::EdgeWeight
) -> Self::EdgeId