MathGroup Archive 2010

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

Search the Archive

Weighted graphs with sum of weights determining vertex placement?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112121] Weighted graphs with sum of weights determining vertex placement?
  • From: Luci Ellis <luci at verbeia.com>
  • Date: Tue, 31 Aug 2010 04:17:44 -0400 (EDT)

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, 18, 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], Black, 
     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: "Abort Evaluation" does not work
  • Next by Date: Re: Numerical solution of coupled nonlinear PDEs
  • Previous by thread: Re: Can I programming little applications by Mathematica, just like Java
  • Next by thread: Re: Could you prove this proposition:the i-th prime gap p[i+1]-p[i]<=i