Tag Info

New answers tagged

4

Anyway, Treegraph offers a lot of flexibility: nodes = {RandomInteger[#] , # + 1} & /@ Range[0, 30]; rn = Range@Length@nodes; crules = Rule @@@ Partition[Riffle[rn, ColorData[15, "ColorList"]], 2]; g = TreeGraph[UndirectedEdge @@@ nodes, VertexSize -> 0.4, VertexStyle -> crules]; HighlightGraph[g, PathGraph@FindShortestPath[g, 1, 30], ...


3

myVertexes = {"xxx", "yyy", "Block3", "p5", "Block2", "Block1", "p3", "p2", "p1"}; myVertexLabels = Table[myVertexes[[i]] -> Placed[Panel[myVertexes[[i]]], Center], {i, Length[myVertexes]}]; myEdgeShape[el_, ___] := Arrow[el, 0.2]; TreeCFGNVM = TreeGraph[{"xxx" -> "yyy", "yyy" -> "Block3", "yyy" -> "Block2", "yyy" -> ...


0

Similar to the one in the documentation. I just made it into a function so that you can specify the number of vertices. randomTree[n_, opts___] := Graph[Range@n, # + 1 <-> RandomInteger[{1, #}] & /@ Range[n - 1], opts]


1

myVertexes = {"Criminals", "cat", "dog", "human", "killer", "thug", "macho"}; myVertexLabels = Table[myVertexes[[i]] -> Placed[Rotate[ Panel[myVertexes[[i]], Background -> If[AnyTrue[{"Criminals", "human", "macho"}, # == myVertexes[[i]] &], Orange, Yellow]], -\[Pi]/2], Center], {i, ...


3

I think I found an easy solution : TreeForm[Root["S1", "S2", S3["wtf", NewLol["S1", "f2"]]], DirectedEdges -> True] As you can see S1 is repeated without any issue. The only thing I don't know is how to rotate the tree on the Left side ...


2

Let's start by changing the edge definitions so that the vertex "p2" is split into two vertices, "p2a" and "p2b". $edges = { "Mystery" -> "SubSystems" , "SubSystems" -> "SysVar3" , "SubSystems" -> "SysVar2" , "SubSystems" -> "SysVar1" , "SysVar1" -> "p1" , {"p1" -> "Sp12", "value set"} , {"p1" -> "Sp11", "value set"} , ...


1

It sounds likely that the problem would be better addressed by constructing the tree in the proper order than by fixing it afterwords. The basic step should have the form newtree = Join[{newedges}, {oldtree}] See Join[{troot -> broot}, branch, tree] in addbranch below. Example: The basic data structure in the construction consists of the edges of ...


3

gr = {1 -> 4, 1 -> 6, 1 -> 8, 2 -> 6, 3 -> 8, 4 -> 5, 7 -> 8}; TreePlot[SortBy[gr, -Last[#] &], VertexLabeling -> True]



Top 50 recent answers are included