next | previous | forward | backward | up | top | index | toc | Macaulay2 website
PhylogeneticTrees :: leafTree

leafTree -- construct a LeafTree



An object of class LeafTree is specified by listing its leaves, and for each internal edge, the partition the edge induces on the set of leaves. L is the set of leaves, or if an integer n is input then the leaves will be named $0,\ldots,n-1$. E is a list with one entry for each internal edge. Each entry is a partition specified as a list or set of the leaves in one side of the partition. Thus each edge can be specified in two possible ways.

An object of class LeafTree can also be constructed from a Graph provided the graph has no cycles.

Here we construct the quartet tree, which is the tree with 4 leaves and one internal edge.

i1 : T = leafTree({a,b,c,d},{{a,b}})

o1 = {{a, b, c, d}, {set {a, b}, set {a}, set {b}, set {c}, set {d}}}

o1 : LeafTree
i2 : leaves T

o2 = set {a, b, c, d}

o2 : Set
i3 : edges T

o3 = {set {a, b}, set {a}, set {b}, set {c}, set {d}}

o3 : List

Here is a tree with 5 leaves given as a Graph.

i4 : G = graph{{a,b},{c,b},{b,d},{d,e},{d,f},{f,g},{f,h}}

o4 = Graph{a => {b}      }
           b => {a, c, d}
           c => {b}
           d => {b, e, f}
           e => {d}
           f => {d, g, h}
           g => {f}
           h => {f}

o4 : Graph
i5 : T = leafTree G

o5 = {{a, c, e, g, h}, {set {a, c}, set {a, c, e}, set {a}, set {c}, set {e},
     set {g}, set {h}}}

o5 : LeafTree
i6 : leaves T

o6 = set {a, c, e, g, h}

o6 : Set
i7 : internalEdges T

o7 = {set {a, c}, set {a, c, e}}

o7 : List

Ways to use leafTree :

For the programmer

The object leafTree is a method function.