Skip to main content

Build

Trait Build 

Source
pub trait Build: Data + NodeCount {
    // 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;

    // Provided method
    fn add_edge(
        &mut self,
        a: Self::NodeId,
        b: Self::NodeId,
        weight: Self::EdgeWeight,
    ) -> Option<Self::EdgeId> { ... }
}
Expand description

A graph that can be extended with further nodes and edges

Required Methods§

Source

fn add_node(&mut self, weight: Self::NodeWeight) -> Self::NodeId

Source

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§

Source

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.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<E, Ix: IndexType> Build for List<E, Ix>

Source§

impl<N, E, Ty, Ix> Build for Graph<N, E, Ty, Ix>
where Ty: EdgeType, Ix: IndexType,

Source§

impl<N, E, Ty, Ix> Build for StableGraph<N, E, Ty, Ix>
where Ty: EdgeType, Ix: IndexType,

Available on crate feature stable_graph only.
Source§

impl<N, E, Ty: EdgeType, Null: Nullable<Wrapped = E>, Ix: IndexType> Build for MatrixGraph<N, E, Ty, Null, Ix>

Source§

impl<N, E, Ty> Build for GraphMap<N, E, Ty>
where Ty: EdgeType, N: NodeTrait,

Available on crate feature graphmap only.