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

digraph -- The function that creates a digraph

Synopsis

Description

The digraph is stored as a hash table whose keys are the names of the nodes and whose values are the children of those nodes. The user inputs a digraph by inputting a list of pairs whose first element is a node and whose second element is the list of children of that node. If a node has no children, it should still be included in the list of pairs followed by an empty list. Alternatively, one could also input a hash table where the keys are the nodes and the values the set of children.
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

Ways to use digraph :