bfs {RBGL} | R Documentation |
These functions carry out breadth and depth first search using
routines from the BOOST library. For dfs
a list
containing two vectors
is returned. These indicate the sequence
in which a node is first visited and last visited. For dfs
a
single vector is returned indicating the order in which a node was visited.
bfs(graph, init.node=1, checkConn=FALSE) ## S4 method for signature 'graph': dfs(graph) ## S4 method for signature 'graph': bfs(graph)
graph |
instance of class graph from Bioconductor graph class |
init.node |
index (1 based) of where to start search |
checkConn |
logical indicating whether connectivity of input graph should be checked |
calls to boost bfs or dfs procedures
for bfs: vector of indices in order of BFS visit
for dfs:
list of two vectors of nodes, order of DFS discovery,
and order of DFS completion (finish)
VJ Carey <stvjc@channing.harvard.edu>
dd <- fromGXL(file(system.file("XML/bfsex.gxl",package="RBGL"))) dd@edgemode <- "undirected" bfs(dd) bfs(dd,2) dd <- fromGXL(file(system.file("XML/dfsex.gxl",package="RBGL"))) dfs(dd)