Tag Info

New answers tagged

2

Just use TreePlot with VertexCoordinateRules. I have tried like this. treePlot[k_] := Module[{grp, pos}, grp = DeleteCases[Flatten@Table[ {n[j, i - j] -> n[j, i - 1 - j], n[j, i - j] -> n[j + 1, i - 1 - j]}, {i, k}, {j, 0, i}], n[__] -> n[_, _?(# < 0 &)]]; pos = Flatten@Table[n[j, i - j] -> {(j + i)/3, i - j}, ...


8

A function to recursively generate the edges: n[_, 0] := {}; n[x : 0, y_Integer] /; y > 0 := {{x, y} -> {x, y - 1}, {x, y} -> {x + 1, y - 1}, n[x + 1, y - 1], n[x, y - 1]}; n[x_Integer, y_Integer] /; y > 0 := {{x, y} -> {x, y - 1}, {x, y} -> {x + 1, y - 1}, n[x + 1, y - 1]}; We have to sort the vertices so that the ...


8

Creating the edge list The index and edges can be worked out like this: step[list_, n_] := Block[ { ln1 = list[[1]] , ln2 = list[[2]] }, Join[ If[ln2 < n , {{ln1, ln2 + 1} -> {ln1, ln2}}, {}], If[ln2 < n, {{ln1, ln2 + 1} -> {ln1 + 1, ln2 }}, {}], If[ln1 + ln2 + 1 < n, step[{ln1, ln2 + 1}, n], {}], ...


10

Update: functions to generate the edge list, indices and labels: ClearAll[layersF, edgesF, subscF, indicesF]; layersF = Module[{k = 1}, Table[k++, {i, #}, {j, i}]] &; edgesF = Flatten[Thread /@ Thread[# -> Partition[#2, 2, 1]] & @@@ Partition[layersF[#], 2, 1], 2] &; indicesF = Reverse[Thread /@ ...


3

ClearAll[dL]; dL = Function[{str}, With[{s = Last@str}, Thread[s -> DictionaryLookup[Alternatives @@ (StringExpression @@ StringSplit[StringInsert[s, ".", #], "." -> LetterCharacter] & /@ Range[1 + StringLength@s])]]], Listable]; edges = DeleteDuplicates@Flatten@Rest@NestList[dL, {"a" ...


3

I post this (if I understand the question from title and text: single letter addition anywhere in string) to illustrate how unwieldy the graph gets just 3 levels deep. Here just starting with "a". fun[x_] := With[{c = Characters[x]}, Thread[x -> Select[ DictionaryLookup[ StringExpression @@ Riffle[c, ___, {1, 2 Length@c + 1, 2}]], ...


3

I am the original poser of this question which is not a homework question as belisarius could have realized by noting my identity. (Frankly, belisarius' statement that it was related to a homework problem he assigned did nothing to help me and others interested, and in fact apparently dissuaded others from addressing this problem. I grant that all would ...



Top 50 recent answers are included