MathGroup Archive 2008

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

Search the Archive

Re: Graph with different edge thicknesses

  • To: mathgroup at smc.vnet.net
  • Subject: [mg85509] Re: Graph with different edge thicknesses
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Wed, 13 Feb 2008 04:10:40 -0500 (EST)
  • References: <fopbs0$c3b$1@smc.vnet.net>

On Feb 11, 12:34 pm, Gaudium <nesea... at gmail.com> wrote:
> Hello all, I created a graph with edges {1->2,1->3,2->4,2->5}. But I
> want that these edge lines have thickness values {0.01,
> 0.02,0.03,0.04} respectively. How can I do that with
> EdgeRenderingFunction? Thank you.

Quick and dirty solution:

In[1]:= edges = {1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5}
Out[1]= {1 -> 2, 1 -> 3, 2 -> 4, 2 -> 5}

In[2]:= thickness = {0.01, 0.02, 0.03, 0.04}
Out[2]= {0.01, 0.02, 0.03, 0.04}

In[3]:= thickness /= 3. (* tone it down a bit *)
Out[3]= {0.00333333, 0.00666667, 0.01, 0.0133333}

In[4]:= GraphPlot[edges,
 EdgeRenderingFunction ->
  ({Thickness[thickness[[First@First@Position[edges, Rule @@ #2]]]],
     Arrow[#1, .05]} &)]


  • Prev by Date: Re: open URL programmatically?
  • Next by Date: Re: more looping trouble
  • Previous by thread: Re: Graph with different edge thicknesses
  • Next by thread: Re: Graph with different edge thicknesses