IsCaterpillarTree - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

IsCaterpillarTree

  

test if graph is a caterpillar tree

  

IsLobsterTree

  

test if graph is a lobster tree

 

Calling Sequence

Parameters

Description

Definition

Examples

Compatibility

Calling Sequence

IsCaterpillarTree(G)

IsLobsterTree(G)

Parameters

G

-

graph

Description

• 

IsCaterpillarTree(G) returns true if G is a caterpillar tree and false otherwise.

• 

IsLobsterTree(G) returns true if G is a lobster tree and false otherwise.

Definition

• 

A graph G is a caterpillar tree if it is a tree and there exists a path in G such that every vertex in G is either on the path or adjacent to a vertex on the path.

• 

A graph G is a lobster tree if it is a tree and the result of removing all leaf #nodes of G is a caterpillar tree.

Examples

withGraphTheory:

This graph is a caterpillar tree.

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

G1Graph 1: an undirected graph with 9 vertices and 8 edges

(1)

DrawGraphG1,style=planar

IsCaterpillarTreeG1

true

(2)

IsLobsterTreeG1

true

(3)

This graph is a lobster tree but not a caterpillar tree.

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

G2Graph 2: an undirected graph with 9 vertices and 8 edges

(4)

DrawGraphG2,style=planar

IsCaterpillarTreeG2

false

(5)

IsLobsterTreeG2

true

(6)

This graph is a tree but not a lobster tree (or a caterpillar tree).

G3GraphUnionPathGraph7,PathGraph4,8,9,10

G3Graph 3: an undirected graph with 10 vertices and 9 edges

(7)

DrawGraphG3,style=spring

IsTreeG3

true

(8)

IsLobsterTreeG3

false

(9)

Compatibility

• 

The GraphTheory[IsCaterpillarTree] and GraphTheory[IsLobsterTree] commands were introduced in Maple 2025.

• 

For more information on Maple 2025 changes, see Updates in Maple 2025.

See Also

IsTree