TreeHeight - Maple Help

Online Help

All Products    Maple    MapleSim


GraphTheory

  

TreeHeight

  

compute tree height

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

TreeHeight(T, r)

Parameters

T

-

tree

r

-

(optional) vertex

Description

• 

TreeHeight returns the height of the tree T with the vertex r as root. In other words it returns the maximum distance of the vertices of T from r.

• 

If the root r is omitted, TreeHeight returns the diameter of G.

Examples

withGraphTheory:

TGraph1,2,2,3,2,4,4,5

TGraph 1: an undirected unweighted graph with 5 vertices and 4 edge(s)

(1)

TreeHeightT,1

3

(2)

TreeHeightT,4

2

(3)

DrawGraphT

Compatibility

• 

The GraphTheory[TreeHeight] command was updated in Maple 2021.

See Also

Diameter

IsTree

SpanningTree