BFS: Performs Breadth-first search for a tree and finds a spanning...

Description Usage Arguments Value

Description

Performs Breadth-first search for a tree and finds a spanning tree.

Usage

1
2
3
4
BFS(graph, root = sample.int(length(graph), size = 1),
  Q = makequeue(length(graph)), bft = rep(NA, length(graph)),
  depth = rep(NA, length(graph)), st = rep(NA, length(graph)),
  treecount = 1)

Arguments

graph

a list whose elements correspond to nodes and contain a vector of nodes neighbours.

root

index of the root.

Value

A vector which contains the index of the parent node. The root node's parent node has a index of zero.


edahelsinki/cyclesampler documentation built on June 9, 2019, 10:51 a.m.