MathGroup Archive 2009

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

Search the Archive

Re: two graph problems in Adjacency types

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99590] Re: two graph problems in Adjacency types
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Fri, 8 May 2009 00:19:27 -0400 (EDT)
  • References: <gtudk6$j0j$1@smc.vnet.net>

And the question is...?

On May 7, 12:36 pm, Roger Bagula <rlbag... at sbcglobal.net> wrote:
> I have two graph handling problems:
>
> 1) ToAdjacencyMatrix
>
> g below works with:
> << DiscreteMath`GraphPlot`;
> g = { 1 -> 2, 1 -> 4, 1 -> 5, 1 ->
>    9, 2 -> 1, 2 -> 3, 2 -> 6, 2 -> 10, 3 -> 2,  3 -> 4,
>     3 -> 7,  3 -> 10, 4 -> 1, 4 -> 3, 4 -> 8, 4 -> 12, 5 -> 1, 5 ->
>     6, 5 -> 8, 5 -> 9, 6 -> 2,  6 -> 5, 6 -> 7,  6 -> 10, 7 -> 3,=
 7 -> 6,
>     7 -> 8, 7 -> 11, 8 -> 4, 8 -> 5, 8 -> 7, 8 -> 12, 9 -> 1, 9 -> 5,
>     9 -> 10, 9 -> 12, 10 -> 2, 10 -> 6, 10 -> 9, 10 -> 11, 11 -> 3,
>     11 -> 7, 11 -> 10, 11 -> 12, 12 -> 4, 12 -> 8, 12 -> 9,  12 -> =
11};
> GraphPlot[g, "EdgeStyleFunction" -> (Arrow[{#1, #2}] &)];
>
> 2) FromAdjacencyList
>
> g2 below works with:
> << DiscreteMath`ComputationalGeometry`
> PlanarGraphPlot[g2, TextStyle -> {"FontSize" -> 8}]
> DiagramPlot[g2]
>
> 1) Mathematica:
>
> << DiscreteMath`ComputationalGeometry`
> << DiscreteMath`Combinatorica`
> g = { 1 -> 2, 1 -> 4, 1 -> 5, 1 -> 9, 2 -> 1, 2 -> 3, 2 -> 6, 2 -> 10, =
3 ->
>     2,  3 -> 4, 3 -> 7,  3 -> 10, 4 -> 1, 4 -> 3,
>     4 -> 8, 4 -> 12, 5 -> 1, 5 -> 6, 5 -> 8, 5 -> 9, 6 -> 2,  6 -> =
5, 6 ->
>     7,  6 -> 10, 7 -> 3, 7 -> 6, 7 -> 8, 7 -> 11, 8 -> 4, 8 -> 5, 8=
 ->
>     7, 8 -> 12, 9 -> 1, 9 -> 5, 9 -> 10, 9 -> 12, 10 -> 2, 10 -> 6,
>     10 -> 9, 10 -> 11, 11 -> 3, 11 -> 7, 11 -> 10, 11 ->
>      12, 12 -> 4, 12 -> 8, 12 -> 9,  12 -> 11};
> ShowGraph[g]
> ToAdjacencyMatrix[g]
>
> 2) Mathematica:
>
> Needs["Combinatorica`"]
> g2 = {{-0.9280755637296179`, -0.19419929835443286`},
> {-0.9280755637296179`, \
> 0.19419929835443286`}, {-0.6501667625820613`, -0.2919430658415227`}, \
> {-0.6501667625820613`, 0.2919430658415227`}, {-0.48283076848225387`, \
> -0.11693236237728927`}, {-0.48283076848225387`, 0.11693236237728927`}, \
> {-1.1392923850800492`, -0.46926092334332986`}, {-1.1392923850800492`, \
> 0.46926092334332986`}, {-1.4197713561114567`, 0}, {-0.4785669339713638`, =
\
> -0.5281299674972387`}, {-0.4785669339713638`,
>       0.5281299674972387`}, {-0.2866442761736428`,
> -0.20825925704946527`}, \
> {-0.2866442761736428`, 0.20825925704946527`}, {-0.7983543675400564`, \
> -0.9385218466866597`}, {-0.7983543675400564`, 0.9385218466866597`}, \
> {-0.4714856294164916`, -0.8226414290121405`}, {-0.4714856294164916`, \
> 0.8226414290121405`}, {-0.2604121980728394`, -0.423065261465852`}, \
> {-0.2604121980728394`, 0.423065261465852`}, {-1.2647924812445637`, 0}, \
> {-0.129178585243926`, -0.093853735887278`}, {-0.129178585243926`,
>         0.093853735887278`}, {-0.43873347716520544`,
> -1.350282799879008`}, \
> {-0.43873347716520544`, 1.350282799879008`}, {-0.1020966130966314`, \
> -0.9426631959865617`}, {-0.3908423710622271`, -1.2028891310487582`}, \
> {-0.3908423710622271`, 1.2028891310487582`}, {-0.1020966130966314`, \
> 0.9426631959865617`}, {-0.03799362766342498`, -0.49533343579983613`}, \
> {-0.03799362766342498`, 0.49533343579983613`}, {0.09423295043665249`, \
> -1.2285410469049964`}, {0.09423295043665249`, 1.2285410469049964`}, \
> {0.07674177634016656`, -0.7085607049671481`}, {0.04934182894455409`, \
> -0.15185853463677154`}, {0.04934182894455409`, 0.15185853463677154`}, \
> {0.07674177634016656`, 0.7085607049671481`}, {0.10948837081771987`, \
> -0.3369705563778359`}, {0.10948837081771987`, 0.3369705563778359`}, \
> {1.0232386116845091`, -0.743426367685959`}, {1.0232386116845091`, \
> 0.743426367685959`}, {0.15967351259874374`, 0}, {0.6458822508733686`, \
> -1.0492993237800035`}, {0.6458822508733686`, 1.0492993237800035`}, \
> {0.3543961314959318`, -0.6183453362321933`}, {0.3543961314959318`, \
> 0.6183453362321933`}, {0.32188717898816915`, -0.3784010734225469`}, \
> {0.32188717898816915`, 0.3784010734225469`}, {1.148619155220934`, \
> -0.8345206647495994`}, {1.148619155220934`, 0.8345206647495994`}, \
> {0.6366814195430888`, -0.7026196620377195`}, {0.6366814195430888`, \
> 0.7026196620377195`}, {0.35431181071184575`, 0}, {0.4593494152303489`, \
> -0.18920053671127346`}, {0.4593494152303489`, 0.18920053671127346`}, \
> {1.1975315513100848`, -0.2900192002183368`}, {1.1975315513100848`, \
> 0.2900192002183368`}, {0.8649763866996519`, -0.38839859670886573`}, \
> {0.8649763866996519`, 0.38839859670886573`}, {0.6975957887173267`, \
> -0.14597153292076134`}, {0.6975957887173267`, 0.14597153292076134`}};
>
> FromAdjacencyLists[g2]



  • Prev by Date: Re: Odd ordering of results?
  • Next by Date: Re: two graph problems in Adjacency types
  • Previous by thread: Re: two graph problems in Adjacency types
  • Next by thread: Re: two graph problems in Adjacency types