| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Bioinformatics Toolbox |
| Contents | Index |
| Learn more about Bioinformatics Toolbox |
[disc, pred, closed] = traverse(BGObj, S)
[...] = traverse(BGObj, S, ...'Depth', DepthValue, ...)
[...] = traverse(BGObj, S, ...'Directed', DirectedValue, ...)
[...] = traverse(BGObj, S, ...'Method', MethodValue, ...)
| 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 N-by-N 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 | String that specifies the algorithm used to traverse the graph.
Choices are:
|
Tip For introductory information on graph theory functions, see Graph Theory Functions in the Bioinformatics Toolbox User's Guide. |
[disc, pred, closed] = traverse(BGObj, S) traverses the directed graph represented by an N-by-N adjacency matrix extracted from a biograph object, BGObj, starting from the node indicated by integer S. In the N-by-N 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(BGObj, S, ...'PropertyName', PropertyValue, ...) calls 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(BGObj, S, ...'Depth', DepthValue, ...) specifies the depth of the search. DepthValue is
an integer indicating a node in the graph represented by the N-by-N
adjacency matrix extracted from a biograph object, BGObj.
Default is Inf (infinity).
[...] = traverse(BGObj, S, ...'Directed', DirectedValue, ...) indicates whether the graph represented by the N-by-N adjacency matrix extracted from a biograph object, 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(BGObj, S, ...'Method', MethodValue, ...) lets you specify the algorithm used to traverse the graph represented by the N-by-N adjacency matrix extracted from a biograph object, BGObj. Choices are:
'BFS' — Breadth-first search. Time complexity is O(N+E), where N and E are number of nodes and edges respectively.
'DFS' — Default algorithm. Depth-first search. Time complexity is O(N+E), where N and E are number of nodes and edges respectively.
[1] Sedgewick, R., (2002). Algorithms in C++, Part 5 Graph Algorithms (Addison-Wesley).
[2] Siek, J.G., Lee, L-Q, and Lumsdaine, A. (2002). The Boost Graph Library User Guide and Reference Manual, (Upper Saddle River, NJ:Pearson Education).
Bioinformatics Toolbox functions: biograph (object constructor), graphtraverse
Bioinformatics Toolbox object: biograph object
Bioinformatics Toolbox methods of a biograph object: allshortestpaths, conncomp, isdag, isomorphism, isspantree, maxflow, minspantree, shortestpath, topoorder
![]() | traceplot | var (DataMatrix) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |