Template Function NetworKit::GraphTools::subgraphFromNodes(const Graph&, InputIt, InputIt, bool)

Function Documentation

template<class InputIt>
Graph NetworKit::GraphTools::subgraphFromNodes(const Graph &G, InputIt first, InputIt last, bool compact = false)

Returns an induced subgraph of the input graph (including potential edge weights/directions)

The subgraph contains all nodes in the given node range and all edges which have both end points in nodes.

Parameters:
  • G – The input graph.

  • first, last – The range of nodes of the induced subgraph.

  • compact – If the resulting graph shall have compact, continuous node ids, alternatively, node ids of the input graph are kept.

Returns:

Induced subgraph.