next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Graphs :: descendents

descendents -- Returns the descendents of a node in a digraph or mixed graph.

Synopsis

Description

This is a function which takes as input a digraph or a mixedGraph and a symbol giving the node of interest. It returns a set of the keys for the descendents of that node.
i1 : D = digraph({{a, {b,c}}, {b,{d,e}}, {c, {e,h}}, {d, {f}}, {e, {f,g}},
         {f, {}}, {g, {}}, {h, {}}})

o1 = Digraph{a => set {b, c}}
             b => set {d, e}
             c => set {e, h}
             d => set {f}
             e => set {f, g}
             f => set {}
             g => set {}
             h => set {}

o1 : Digraph
i2 : descendents(D,c)

o2 = set {e, f, g, h}

o2 : Set
In the case of a mixedGraph the set is the descendents of the node as a node in the digraph part of the mixed graph.
i3 : H = mixedGraph(graph{{a,b},{a,f},{c,f}}, D)

o3 = MixedGraph{Bigraph => Bigraph{}               }
                Digraph => Digraph{a => set {b, c}}
                                   b => set {d, e}
                                   c => set {e, h}
                                   d => set {f}
                                   e => set {f, g}
                                   f => set {}
                                   g => set {}
                                   h => set {}
                Graph => Graph{a => set {b, f}}
                               b => set {a}
                               c => set {f}
                               f => set {a, c}

o3 : MixedGraph
i4 : descendents(H,c)

o4 = true
i5 : descendents(H,e)

o5 = set {f, g}

o5 : Set

Ways to use descendents :