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

Online Help

All Products    Maple    MapleSim


GraphTheory

  

Ancestors

  

list ancestors of a given vertex

  

Descendants

  

list descendants of a given vertex

 

Calling Sequence

Parameters

Options

Description

Definition

Examples

Compatibility

Calling Sequence

Ancestors(G, v)

Ancestors(G, v, opts)

Descendants(G, v)

Descendants(G, v, opts)

Parameters

G

-

graph

v

-

vertex of the graph

opts

-

(optional) one or more options as specified below

Options

• 

output=one of graph or list

  

Specifies whether the result should be a list of vertices reachable from v or the subgraph induced by the vertices reachable from v. The default is list.

Description

• 

Ancestors(G,v) returns a list of all ancestors of v in G, that is, vertices in G from which v is reachable.

• 

Descendants returns a list of all descendants of v in G, that is, vertices in G which are reachable from the vertex v.

• 

Note that the input vertex v is excluded from the output, even if the graph contains a loop including v.

• 

To produce an actual spanning tree of vertices reachable from v, see SpanningTree or MinimalSpanningTree.

Definition

• 

If G is a directed graph and there exists a directed path in G from u to v, then u is said to be an ancestor of v, and v is said to be descendant of u.

Examples

withGraphTheory:

C6CycleGraph6,directed

C6Graph 1: a directed graph with 6 vertices and 6 arcs

(1)

DrawGraphC6

AncestorsC6,6

1,2,3,4,5

(2)

AncestorsC6,6,output=graph

Graph 2: a directed graph with 5 vertices and 4 arcs

(3)

TGraph5,1,2,1,4,2,3,4,5

TGraph 3: a directed graph with 5 vertices and 4 arcs

(4)

DrawGraphT

AncestorsT,4

1

(5)

DescendantsT,4

5

(6)

Compatibility

• 

The GraphTheory[Ancestors] and GraphTheory[Descendants] commands were introduced in Maple 2025.

• 

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

See Also

LowestCommonAncestors

MinimalSpanningTree

ShortestAncestralPath

SpanningTree

 


Download Help Document