MathGroup Archive 2005

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

Search the Archive

Re: plotting weighted graphs

  • To: mathgroup at
  • Subject: [mg55408] Re: [mg55349] plotting weighted graphs
  • From: János <janos.lobb at>
  • Date: Tue, 22 Mar 2005 03:50:58 -0500 (EST)
  • References: <> <>
  • Sender: owner-wri-mathgroup at

Try something like

VertexStyleFunction -> (Text[H[[# - 1]][[2]], #] &)


VertexStyleFunction -> (Text[H[[#1 - 1]], #1] & )

and similar combinations.  There is an "advanced" help about GraphPlot 
in the help and there are some samples there.

On Mar 19, 2005, at 4:47 AM, Erik Itter wrote:

> Thx,
> 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
> To: mathgroup at
> Subject: [mg55408] [mg55349] Re: [mg55299] plotting weighted graphs
> Erik,
> 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: Import Problem Further Explanation
  • Next by Date: Re: Restriction on the domain of Plot3D
  • Previous by thread: plotting weighted graphs
  • Next by thread: Re: plotting weighted graphs