networkit.traversal

class networkit.traversal.Traversal

Bases: object

All methods from this module are static. It is not needed to create a Traversal object before calling the functions.

static BFSEdgesFrom(graph, start, callback)

Iterate over edges in breadth-first search order starting from the given node(s).

Parameters:
  • graph (networkit.Graph) – The input graph.

  • start (int or list(int)) – Single node or list of nodes from where the BFS will start.

  • callback (function) – Takes four input parameters: (u, v, edgeweight, edgeid).

static BFSfrom(graph, start, callback)

Iterate over nodes in breadth-first search order starting from the given node(s).

Parameters:
  • graph (networkit.Graph) – The input graph.

  • start (int or list(int)) – Single node or list of nodes from where the BFS will start.

  • callback (function) – Takes either one (node) or two (node, distance) input parameters.

static DFSEdgesFrom(graph, start, callback)

Iterate over edges in depth-first search order starting from the given node(s).

Parameters:
  • graph (networkit.Graph) – The input graph.

  • start (int) – Source node from where the DFS will start.

  • callback (function) – Takes four input parameters: (u, v, edgeweight, edgeid).

static DFSfrom(graph, start, callback)

Iterate over nodes in depth-first search order starting from the given node(s).

Parameters:
  • graph (networkit.Graph) – The input graph.

  • start (int) – Source node from where the DFS will start.

  • callback (function) – Takes a node as input parameter.

static DijkstraFrom(graph, start, callback)

Iterate over nodes with Dijkstra search order starting from the given node(s).

Parameters:
  • graph (networkit.Graph) – The input graph.

  • start (int or list(int)) – Single node or list of nodes from where Dijkstra will start.

  • callback (function) – Takes either one (node) or two (node, distance) input parameters.