traverse (biograph)
(To be removed) Traverse biograph object by following adjacent nodes
Syntax
[
disc
, pred
, closed
] = traverse(BGObj
, S
)
[...] = traverse(BGObj
, S
, ...'Depth', DepthValue
, ...)
[...] = traverse(BGObj
, S
, ...'Directed', DirectedValue
, ...)
[...] = traverse(BGObj
, S
, ...'Method', MethodValue
, ...)
Arguments
BGObj
 Biograph object created by biograph (object
constructor). 
S  Integer that indicates the source node in
BGObj . 
DepthValue  Integer that indicates a node in BGObj
that specifies the depth of the search. Default is
Inf (infinity). 
DirectedValue  Property that indicates whether graph represented by an NbyN
adjacency matrix extracted from a biograph object,
BGObj is directed or undirected.
Enter false for an undirected graph. This results
in the upper triangle of the sparse matrix being ignored. Default is
true . 
MethodValue  Character vector that specifies the algorithm used to traverse
the graph. Choices are:

Description
Tip
For introductory information on graph theory functions, see Graph Theory Functions.
[
traverses the directed graph represented by an NbyN adjacency matrix extracted from a
biograph object, disc
, pred
, closed
] = traverse(BGObj
, S
)BGObj
, starting from the node indicated by
integer S
. In the NbyN sparse matrix, all nonzero entries indicate
the presence of an edge. disc
is a vector of node indices in
the order in which they are discovered. pred
is a vector of
predecessor node indices (listed in the order of the node indices) of the resulting
spanning tree. closed
is a vector of node indices in the
order in which they are closed.
[...] =
traverse(
calls
BGObj
, S
, ...'PropertyName
',
PropertyValue
, ...)traverse
with optional properties that use property name/property
value pairs. You can specify one or more properties in any order. Each
PropertyName
must be enclosed in single quotes and is
case insensitive. These property name/property value pairs are as follows:
[...] = traverse(
specifies the depth of the search. BGObj
, S
, ...'Depth', DepthValue
, ...)DepthValue
is an integer
indicating a node in the graph represented by the NbyN adjacency matrix extracted from
a biograph object, BGObj
. Default is Inf
(infinity).
[...] = traverse(
indicates whether the graph represented by the NbyN adjacency matrix extracted from a
biograph object, BGObj
, S
, ...'Directed', DirectedValue
, ...)BGObj
is directed or undirected. Set
DirectedValue
to false
for an
undirected graph. This results in the upper triangle of the sparse matrix being ignored.
Default is true
.
[...] = traverse(
lets you specify the algorithm used to traverse the graph represented by the NbyN
adjacency matrix extracted from a biograph object, BGObj
, S
, ...'Method', MethodValue
, ...)BGObj
.
Choices are:
'BFS'
— Breadthfirst search. Time complexity isO(N+E)
, whereN
andE
are number of nodes and edges respectively.'DFS'
— Default algorithm. Depthfirst search. Time complexity isO(N+E)
, whereN
andE
are number of nodes and edges respectively.
References
[1] Sedgewick, R., (2002). Algorithms in C++, Part 5 Graph Algorithms (AddisonWesley).
[2] Siek, J.G., Lee, LQ, and Lumsdaine, A. (2002). The Boost Graph Library User Guide and Reference Manual, (Upper Saddle River, NJ:Pearson Education).