Function subgraph

Source
pub fn subgraph<N, E, Ix>(
    graph: &Graph<N, E, Ix>,
    nodes: &HashSet<N>,
) -> Graph<N, E, Ix>
where N: Node + Clone, E: EdgeWeight + Clone, Ix: IndexType,
Expand description

Extracts a subgraph containing only the specified nodes

§Arguments

  • graph - The input graph
  • nodes - The set of nodes to include in the subgraph

§Returns

  • A new graph containing only the specified nodes and edges between them