GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/SpanningTree

GraphTheory

  

SpanningTree

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

SpanningTree(G)

SpanningTree(G, r)

Parameters

G

-

undirected graph

r

-

vertex of the graph

Description

• 

The SpanningTree command returns a spanning tree of G, a subgraph that contains all the vertices and is a tree. Edge weights are ignored.

• 

To compute a minimal-weight spanning tree for a weighted graph, use MinimalSpanningTree.

Examples

withGraphTheory:

withSpecialGraphs:

PPetersenGraph

PGraph 1: an undirected unweighted graph with 10 vertices and 15 edge(s)

(1)

T1SpanningTreeP

T1Graph 2: an undirected unweighted graph with 10 vertices and 9 edge(s)

(2)

IsTreeT1

true

(3)

DrawGraphP

DrawGraphT1

T2SpanningTreeP,5:

EdgesT1

1,2,1,5,1,6,2,3,2,9,4,5,5,8,6,7,6,10

(4)

EdgesT2

1,2,1,5,1,6,3,4,4,5,4,10,5,8,7,8,8,9

(5)

See Also

IsTree

MinimalSpanningTree

NumberOfSpanningTrees

TreeHeight