Re: Re: TreePlots and GraphPlots

*To*: mathgroup at smc.vnet.net*Subject*: [mg88631] Re: [mg88609] Re: TreePlots and GraphPlots*From*: Murray Eisenberg <murray at math.umass.edu>*Date*: Sat, 10 May 2008 06:53:36 -0400 (EDT)*Organization*: Mathematics & Statistics, Univ. of Mass./Amherst*References*: <fvudp8$eck$1@smc.vnet.net> <200805091117.HAA21604@smc.vnet.net>*Reply-to*: murray at math.umass.edu

And not that once the TreePlot is displayed, you may want to move the leaves around a bit so as to keep their labels better separated. YOu can do this by double-clicking on the graphic that gives a particular vertex label and just drag it to a new position. Jean-Marc Gulliet wrote: > Namrata Khemka wrote: > >> I have a question regarding TreePlot and GraphPlots. I have the following >> list : >> myList1 = {{1.9124437047927545`, 2.140934695277407`, >> 2.4290608973234304`}, {3.1220434925197633`}, {3.193277882536842`, >> 3.321086033303083`, 3.3624160109272454`}, {3.8240882444935016`, >> 4.778362811870326`}} >> >> One of the elements in this list is set as the root node for a tree - based >> structure. For instance : >> treeRoot = myList1[[2]] >> >> Based on the list above : I would like the root node will have 3 children >> The first child has 3 leaf nodes >> {1.9124437047927545`, 2.140934695277407`, 2.4290608973234304`}, the second >> child has three leaf nodes >> {3.193277882536842`, 3.321086033303083`, 3.3624160109272454`} and finally >> the third child has 2 leaf nodes : >> {3.8240882444935016`, 4.778362811870326`}. >> >> In other words, I am trying to represent myList1 in a tree structure. I am >> not able to create a list of rules for the tree. Any suggestions/ >> ideas would be great. > > The following may suit your needs. > > myList1 = {{1.9124437047927545`, 2.140934695277407`, > 2.4290608973234304`}, {3.1220434925197633`}, {3.193277882536842`, > 3.321086033303083`, 3.3624160109272454`}, {3.8240882444935016`, > 4.778362811870326`}}; > > myList2 = > Thread[Table[myList1[[2]], {Length[myList1] - 1}] -> > Delete[myList1, 2]] > > TreePlot[myList2, VertexLabeling -> True] > > {{3.12204} -> {1.91244, 2.14093, > 2.42906}, {3.12204} -> {3.19328, 3.32109, > 3.36242}, {3.12204} -> {3.82409, 4.77836}} > > [... Tree plot deleted ...] > > Regards, > -- Jean-Marc > -- Murray Eisenberg murray at math.umass.edu Mathematics & Statistics Dept. Lederle Graduate Research Tower phone 413 549-1020 (H) University of Massachusetts 413 545-2859 (W) 710 North Pleasant Street fax 413 545-1801 Amherst, MA 01003-9305

**References**:**Re: TreePlots and GraphPlots***From:*Jean-Marc Gulliet <jeanmarc.gulliet@gmail.com>