networks(deprecated)/spantree - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : networks(deprecated)/spantree

networks

  

spantree

  

finds a minimum weight spanning tree

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

spantree(G)

spantree(G, s)

spantree(G, s, w)

Parameters

G

-

graph or network

s

-

starting or root vertex for the tree

w

-

name for returning the sum of the edge weights in the tree

Description

• 

Important: The networks package has been deprecated.Use the superseding command GraphTheory[MinimalSpanningTree] instead.

• 

This routine constructs a spanning tree for the graph G.  The result is returned as a new graph derived from G and consisting of that spanning tree.

• 

The chosen tree has edges which minimize the total edge weight of the tree.

• 

The routine uses Prim's algorithm, which fails if G is not strongly connected.

• 

The routine is normally loaded via the command with(networks) but may also be referenced using the full name networks[spantree](...).

Examples

Important:The networks package has been deprecated.Use the superseding command GraphTheory[MinimalSpanningTree] instead.

withnetworks:

Gpetersen:

endsG

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

(1)

spantreeG,1,w

procxoptionGRAPH,2;ifx=_Edgesthenthisproc_Edgeselifx=_EdgeIndexthenthisproc_EdgeIndextablesymmetricelifx=_Headthenthisproc_Headtableelifx=_Tailthenthisproc_Tailtableelifx=_Eweightthenthisproc_Eweighttableelifx=_Endsthenthisproc_Endstableelifx=_Verticesthenthisproc_Verticeselifx=_Vweightthenthisproc_Vweighttablesparseelifx=_Ancestorthenthisproc_Ancestortableelifx=_Daughterthenthisproc_Daughtertableelifx=_Neighborsthenthisproc_Neighborstableelifx=_Statusthenthisproc_Status'SIMPLE'elifx=_Emaxnamethenthisproc_Emaxname0elsereturn'procnameargs'end ifend proc

(2)

ends

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

(3)

w

9

(4)

See Also

GraphTheory

GraphTheory[MinimalSpanningTree]

networks(deprecated)[shortpathtree]

with