Locators with complete graph, Kn
- To: mathgroup at smc.vnet.net
- Subject: [mg95017] Locators with complete graph, Kn
- From: Jamie Coventry <jcoventry at renaissance.edu.hk>
- Date: Sat, 3 Jan 2009 05:55:08 -0500 (EST)
- References: <g3038u$mei$1@smc.vnet.net> <200806151014.GAA12332@smc.vnet.net>
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