MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Locators with complete graph, Kn

  • To: mathgroup at smc.vnet.net
  • Subject: [mg95063] Re: [mg95055] Re: Locators with complete graph, Kn
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 5 Jan 2009 03:27:05 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <g3038u$mei$1@smc.vnet.net> <200806151014.GAA12332@smc.vnet.net> <gjng66$2l8$1@smc.vnet.net> <200901041235.HAA03706@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Now how might one make such code make use of, or produce as output, the 
kind of Graph object as is handled by Combinatorica` ?

Jens-Peer Kuska wrote:
> Hi,
> 
> makelines[from_, to_] := Line[{from, #}] & /@ to
> 
> completeGraph[pnts_] := Module[{lst = pnts, tmp = pnts},
>    (tmp = DeleteCases[tmp, #]; makelines[#, tmp]) & /@ lst]
> 
> Manipulate[
>   DynamicModule[{pnts, vars, lgraph},
>    pnts = Table[{Cos[t], Sin[t]}, {t, 0., 2 Pi - 0.00001, 2 Pi/n}];
>    vars = Table[Unique["p"], {n}];
>    lgraph = completeGraph[vars];
>    Manipulate @@ {Graphics[lgraph, PlotRange -> 1.2],
>      Sequence @@ ({#, Locator} & /@ Transpose[{vars, pnts}]),
>      Paneled -> False}
>    ]
>   , {{n, 3}, 2, 16, 1}]
> 
> 
> 
> ??
> 
> Regards
>    Jens
> 
> 
> Jamie Coventry wrote:
>> Hi All,
>>
>> I'm trying to create a complete graph with n vertices, with each  
>> vertex having a locator, so that I can drag the vertices to show  
>> isomorphic graphs to Kn. I'm able to create locators at specific  
>> locations (p1, p2 etc...), but am going round in circles trying to  
>> improve the code so that can dynamically generate locators at p1,  
>> p2, ..., pn. I've tried working with DynamicModule, but the code below  
>> seems like the closest to a solution.
>>
>> Manipulate[
>>   ptpairs = Tuples[Table[{Cos[t], Sin[t]}, {t, 0, 2 Pi, 2 Pi/n}], 2];
>>   pts = Tuples[Table[{Cos[t], Sin[t]}, {t, 0, 2 Pi, 2 Pi/n}], 1];
>>
>>   Graphics[
>>    Line[{p1, p2}],
>>    PlotRange -> 2
>>    ],
>>
>>   {{p1, pts[[1]][[1]]}, Locator},
>>   {{p2, pts[[2]][[1]]}, Locator},
>>   {n, 2, 10, 1}]
>>
>> Any ideas or thoughts would be appreciated.
>>
>> Thanks in advance,
>>
>> Jamie
>>
> 

-- 
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


  • Prev by Date: Re: Hash function of strings
  • Next by Date: Re: Module and call or others
  • Previous by thread: Re: Locators with complete graph, Kn
  • Next by thread: Fourier Transform Graph Coordinates