Services & Resources / Wolfram Forums / MathGroup Archive
-----

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: [mg85523] Re: Graph with different edge thicknesses
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 13 Feb 2008 04:17:53 -0500 (EST)
  • References: <fopbs0$c3b$1@smc.vnet.net>


Hi,

here is a simple solution using a counter:

count = 1;

g = LayeredGraphPlot[{1 -> 2, 1 -> 3},

   EdgeRenderingFunction -> ({Thickness[0.001 count++], Arrow[#1]} &)]

However, there is a hitchup. The EdgeRenderingFunction is called twice 

on every edge (I do not know why). To prevent drawing each edge twice 

with different thickness, we may use a function that remembers its values:

count=1;

Clear[getThickness];

getThickness[d_]:=getThickness[d]=0.004  count++;

g=LayeredGraphPlot[{1->2,1->3},EdgeRenderingFunction->({Thickness[getThickness[#1]],Arrow[#1]}&)]

hope this helps, Daniel



Gaudium 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.

> 




  • Prev by Date: Re: How should I start with mathematica?
  • Next by Date: Table / TableForm Question
  • Previous by thread: Re: Graph with different edge thicknesses
  • Next by thread: NDSolve Percision