AsSubgraph

Trait AsSubgraph 

Source
pub trait AsSubgraph<W, E: Edge<W>>: AsFrozenSubgraph<W, E> {
    // Required methods
    fn remove_edge(
        &mut self,
        src_id: usize,
        dst_id: usize,
        edge_id: usize,
    ) -> Result<()>;
    fn remove_edge_unchecked(
        &mut self,
        src_id: usize,
        dst_id: usize,
        edge_id: usize,
    );
    fn remove_vertex(&mut self, vertex_id: usize) -> Result<()>;
    fn remove_vertex_unchecked(&mut self, vertex_id: usize);
    fn add_vertex_from_graph(&mut self, vertex_id: usize) -> Result<()>;
    fn add_vertex_from_graph_unchecked(&mut self, vertex_id: usize);
    fn add_edge_from_graph(
        &mut self,
        src_id: usize,
        dst_id: usize,
        edge_id: usize,
    ) -> Result<()>;
    fn add_edge_from_graph_unchecked(
        &mut self,
        src_id: usize,
        dst_id: usize,
        edge_id: usize,
    );
}
Expand description

Describes a subgraph that can mutate but the graph that it represents, can not mutate.

Obviously you can remove vertices and edges from the subgraph but it does not remove them from the graph. You can also add already existing vertices and edges from graph to subgraph.

§Note

Functions defined in this trait are abstractions of what is expected from a subgraph. For concrete information about why/when these functions may panic or return Err, refer to the specific subgraph struct that you are using.

§Generic Parameters

  • W: Weight type associated with edges.
  • E: Edge type that subgraph uses.

Required Methods§

Source

fn remove_edge( &mut self, src_id: usize, dst_id: usize, edge_id: usize, ) -> Result<()>

Removes the edge with id: edge_id.

§Arguments
  • src_id: Id of source vertex.
  • dst_id: Id of destination vertex.
  • edge_id: Id of edge to be removed.
§Returns
  • Err
  • Ok: If removal was successful.
Source

fn remove_edge_unchecked( &mut self, src_id: usize, dst_id: usize, edge_id: usize, )

Removes the edge with id: edge_id.

§Arguments
  • src_id: Id of source vertex.
  • dst_id: Id of destination vertex.
  • edge_id: Id of edge to be removed.
Source

fn remove_vertex(&mut self, vertex_id: usize) -> Result<()>

Removes the vertex with id: vertex_id from subgraph.

§Arguments

vertex_id: Id of the vertex to be removed.

§Returns
  • Err
  • Ok: If removal was successful.
Source

fn remove_vertex_unchecked(&mut self, vertex_id: usize)

Removes the vertex with id: vertex_id from subgraph.

§Arguments

vertex_id: Id of the vertex to be removed.

Source

fn add_vertex_from_graph(&mut self, vertex_id: usize) -> Result<()>

Adds a vertex that is already in the graph, to the subgraph.

§Arguments

vertex_id: Id of the vertex to be added from graph to subgraph.

§Returns
  • Err
  • Ok: If addition was successful.
Source

fn add_vertex_from_graph_unchecked(&mut self, vertex_id: usize)

Adds a vertex that is already in the graph, to the subgraph.

§Arguments

vertex_id: Id of the vertex to be added from graph to subgraph.

Source

fn add_edge_from_graph( &mut self, src_id: usize, dst_id: usize, edge_id: usize, ) -> Result<()>

Adds an edge that is already in the graph, to the subgraph.

§Arguments
  • src_id: Id of the source vertex.
  • dst_id: Id of the destination vertex.
  • edge_id: Id of the edge from source vertex to destination vertex.
§Returns
  • Err
  • Ok: If addition was successful.
Source

fn add_edge_from_graph_unchecked( &mut self, src_id: usize, dst_id: usize, edge_id: usize, )

Adds an edge that is already in the graph, to the subgraph.

§Arguments
  • src_id: Id of the source vertex.
  • dst_id: Id of the destination vertex.
  • edge_id: Id of the edge from source vertex to destination vertex.

Implementors§

Source§

impl<'a, W, E, Dir, G> AsSubgraph<W, E> for MultiRootSubgraph<'a, W, E, Dir, G>
where E: Edge<W>, Dir: EdgeDir, G: Graph<W, E, Dir> + Edges<W, E> + Neighbors + Vertices,

MultiRootSubgraph uses Subgraph internally so for more info checkout Subgraph.

Source§

impl<'a, W, E, Dir, G> AsSubgraph<W, E> for MutSubgraph<'a, W, E, Dir, G>
where E: Edge<W>, Dir: EdgeDir, G: Graph<W, E, Dir> + Vertices + Neighbors + Edges<W, E>,

Source§

impl<'a, W, E, Dir, G> AsSubgraph<W, E> for Subgraph<'a, W, E, Dir, G>
where E: Edge<W>, Dir: EdgeDir, G: Graph<W, E, Dir> + Vertices + Neighbors + Edges<W, E>,