MathGroup Archive 2010

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

Search the Archive

Re: Weighted graphs with sum of weights determining vertex placement?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112138] Re: Weighted graphs with sum of weights determining vertex placement?
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Wed, 1 Sep 2010 06:29:03 -0400 (EDT)
  • References: <i5idqu$jtl$1@smc.vnet.net>

With the total weigths in the list sums (sums = Total /@ rawnums)  I
suppose various constructions like

VertexCoordinateRules -> ((Max[sums] - sums) ({Cos[#], Sin[#]} & /@
     Table[i, {i, 0, 2 \[Pi] - 2 \[Pi]/8, 2 \[Pi]/8}]))

or

VertexCoordinateRules -> ((8 -
     Ordering[Ordering[sums]]) ({Cos[#], Sin[#]} & /@
     Table[i, {i, 0, 2 \[Pi] - 2 \[Pi]/8, 2 \[Pi]/8}]))

may meet your needs.

Cheers -- Sjoerd

On Aug 31, 10:17 am, Luci Ellis <l... at verbeia.com> wrote:
> Dear all,
> Suppose I have a weighted adjacency matrix like this:
>
> rawnums={{0, 43, 25, 70, 92, 75, 83, 69}, {0, 0, 0, 0, 0, 0, 0, 2}, {6,
> 28, 0, 1, 0,
>   3, 0, 3}, {26, 1, 2, 0, 4, 1, 7, 14}, {0, 2, 1, 0, 0, 1, 0, 0}, {7, 1=
8, 60,
>   0, 1, 0, 2, 10}, {49, 2, 2, 6, 3, 7, 0, 1}, {12, 5, 10, 23, 0, 13, 7,=
 0}}
>
> Some vertex labels:
> names = ToString /@ Range[8]
>
> And some code to create a graph with edge thickness based on the
> weights, like this:
>
> GraphPlot[Sign[rawnums], DirectedEdges -> True, MultiedgeStyle -> True,
>  VertexRenderingFunction -> ({White, EdgeForm[Black], Disk[#, .04], Bla=
ck,
>      Text[names[[#2]], #1]} &),
>  EdgeRenderingFunction -> (With[{relexp = (rawnums[[#2[[1]], #2[[2]]]=
])/
>         100}, {AbsoluteThickness[relexp*20.],
>       RGBColor[relexp*0.8, relexp*0.8, relexp*0.8],
>       Arrowheads[0.06 relexp + 0.008], Arrow[#1, 0.05]}] &),
>  VertexLabeling -> True, ImageSize -> 500,
>  ImagePadding -> 0, PlotRange -> All, PlotRangePadding -> 0.02]
>
> How do I get the vertices with the highest total weights (in this case
> the sum of each row, since all the columns sum to 100), to sit in the
> centre of the graph, with the less connected / lower-weighted vertices
> at the periphery? I have tried all the alternatives in the Method
> option. VertexCoordinateRules should do the trick, but I have no idea
> how to specify those rules according to the weights.
> Any suggestions? I am not a graph theorist so this is new to me.
>
> Best regards,
> Luci



  • Prev by Date: Re: syntax-aware selection in palette notebook
  • Next by Date: fit with cdf of skew normal distriubtion
  • Previous by thread: Re: syntax-aware selection in palette notebook
  • Next by thread: Re: Weighted graphs with sum of weights determining vertex placement?