next | previous | forward | backward | up | top | index | toc | Macaulay2 website
PhylogeneticTrees :: graph(LeafTree)

graph(LeafTree) -- convert a LeafTree to Graph

Synopsis

Description

This converts a LeafTree representation of a tree into a Graph.

The internal vertices of a LeafTree are not named, so each vertex is specified by the partition of the set of leaves formed by removing the vertex. Each partition is given as a List of Sets.

i1 : T = leafTree(4,{{0,1}})

o1 = {{0, 1, 2, 3}, {set {0, 1}, set {0}, set {1}, set {2}, set {3}}}

o1 : LeafTree
i2 : G = graph T

o2 = Graph{set {set {0, 1, 2}} => {set {set {0, 1}, set {2}, set {3}}}                                                         }
           set {set {0, 1, 3}} => {set {set {0, 1}, set {2}, set {3}}}
           set {set {0, 1}, set {2}, set {3}} => {set {set {0, 1, 2}}, set {set {0, 1, 3}}, set {set {0}, set {1}, set {2, 3}}}
           set {set {0, 2, 3}} => {set {set {0}, set {1}, set {2, 3}}}
           set {set {0}, set {1}, set {2, 3}} => {set {set {0, 1}, set {2}, set {3}}, set {set {0, 2, 3}}, set {set {1, 2, 3}}}
           set {set {1, 2, 3}} => {set {set {0}, set {1}, set {2, 3}}}

o2 : Graph
i3 : adjacencyMatrix G

o3 = | 0 1 1 1 0 0 |
     | 1 0 0 0 0 0 |
     | 1 0 0 0 0 0 |
     | 1 0 0 0 1 1 |
     | 0 0 0 1 0 0 |
     | 0 0 0 1 0 0 |

              6        6
o3 : Matrix ZZ  <--- ZZ