Re: Combinations Dispositions Permutations TREE

• To: mathgroup at smc.vnet.net
• Subject: [mg108868] Re: Combinations Dispositions Permutations TREE
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 5 Apr 2010 08:00:14 -0400 (EDT)

```ClearAll[graph]

graph[elem_?VectorQ, n_Integer?Positive, opts___] :=

Module[{str = ToString /@ elem, tup, nodes, gr},
tup = Select[Tuples[str, n],
Length[Union[#]] == n &];
nodes = FoldList[StringJoin, First[#],
Rest[#]] & /@ tup;
Rule @@@ Partition[#, 2, 1] & /@ nodes}]];
GraphPlot[gr, FilterRules[{opts}, Options[GraphPlot]]]]

graph[{a, b, c, d}, 3, ImageSize -> 500, VertexLabeling -> True]

Bob Hanlon

---- Lele <emanuele.tormene at gmail.com> wrote:

=============
Thanks!!! Could you help me with the second question?

> > 2) I would like to write a function able to draw a tree representing
> > the path going through every k-th step of "fishing" into the list (for
> > every function).
> > For example, given the l={a,b,c} , k=2, I would like to draw a
> > DispositionTree[l,k]
>
> >    a -- b
> >  /    \ c
> > /
> > --b -- a
> > \    \  c
> >  \
> >    c -- a
> >      \ b
>
> > Thanks, Lele (I am sorry for my english, my code and my ignorance)

```

• Prev by Date: Re: Managing packages in the workbench
• Next by Date: size of ticks
• Previous by thread: Re: Combinations Dispositions Permutations TREE