Products & Services Solutions Academia Support User Community Company

Learn more about Bioinformatics Toolbox   

graphisspantree - Determine if tree is spanning tree

Syntax

TF = graphisspantree(G)

Arguments

GN-by-N sparse matrix whose lower triangle represents an undirected graph. Nonzero entries in matrix G indicate the presence of an edge.

Description

TF = graphisspantree(G) returns logical 1 (true) if G is a spanning tree, and logical 0 (false) otherwise. A spanning tree must touch all the nodes and must be acyclic. G is an N-by-N sparse matrix whose lower triangle represents an undirected graph. Nonzero entries in matrix G indicate the presence of an edge.

Examples

  1. Create a phytree object from a phylogenetic tree file.

    tr = phytreeread('pf00002.tree')
    
    Phylogenetic tree object with 33 leaves (32 branches)
  2. Create a connection matrix from the phytree object.

    [CM,labels,dist] = getmatrix(tr);
  3. Determine if the connection matrix is a spanning tree.

    graphisspantree(CM)
    
    ans =
    
         1
  4. Add an edge between the root and the first leaf in the connection matrix.

    CM(end,1) = 1;
  5. Determine if the modified connection matrix is a spanning tree.

    graphisspantree(CM)
    
    ans =
    
         0

References

[1] 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).

See Also

Bioinformatics Toolbox functions: graphallshortestpaths, graphconncomp, graphisdag, graphisomorphism, graphmaxflow, graphminspantree, graphpred2path, graphshortestpath, graphtopoorder, graphtraverse

Bioinformatics Toolbox methods of biograph object: isspantree

  


Recommended Products

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