MathGroup Archive 2005

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

Search the Archive

plotting weighted graphs

  • To: mathgroup at
  • Subject: [mg55349] plotting weighted graphs
  • From: "Erik Itter" <erik.itter at>
  • Date: Sat, 19 Mar 2005 04:47:15 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at


well... its quite simple. I have (e.g., of course the matrices I want to diplay are larger):

<< DiscreteMath`GraphPlot`;

H = {{0, 2, 1}, {2, 0, 4}, {1, 4, 0}}

GraphPlot[H, "EdgeStyleFunction" -> Automatic,
"VertexStyleFunction" -> Automatic]

...which plots the vertices labeled using very tiny numbers and displays the weights using different
colors. I need the vertices numbered readable (greater fontsize) and the weights displayed at the
edges instead or in addition of/to the the coloring. From the help browser I cannot deduce how to
specify such "EdgeStyleFunction" and "VertexStyleFunction". I would also be delighted if someone
pointed out where the documentation about writing such kinds of functions can be found (web or
HelpBrowser, or Mathematica-Book [which hopefully arrives tomorrow by mail ;) ])

And if the question is simply to stupid perhaps someone could point me to the mathematica for
dummies list/tutorial/something...

----- Original Message ----- 
From: "David Park" <djmp at>
To: mathgroup at
Subject: [mg55349] Re: [mg55299] plotting weighted graphs


It is not uncommon on MathGroup to have postings like this that present a
generic question but lack any specific data or code. You are much more
likely to get responses if you present an actual example and Mathematica
code so responders can work from there.

There are many good people on MathGroup and the better they are the busier
they are so if they have to spend much time dreaming up a realistic example
they may just forgo attempting an answer to the question.

David Park
djmp at

From: Erik Itter [mailto:erik.itter at]
To: mathgroup at

Hi, I have a hopefully quite easy question:
    how do you plot graphs with weighted edges?

I have the matrix specified by its adjadcency matrix using different numbers
as weights, works so
far. Now I would like to plot the matrix numbering the vertices from 1 to n
and label the edges with
their weights. Its 5.1 therefore I think I could use GraphPlot (which draws
the graph with no
labeling at all at the moment [but colors depending on weights]) if I knew
the proper
EdgeStyleFunction and VertexStyleFunction.

All suggestions welcome.

  • Prev by Date: Re: Re: Re: Sum
  • Next by Date: Re: Normal Disappear Problem
  • Previous by thread: Re: plotting weighted graphs
  • Next by thread: Re: plotting weighted graphs