MathGroup Archive 2005

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

Search the Archive

Re: plotting weighted graphs

  • To: mathgroup at
  • Subject: [mg55373] Re: plotting weighted graphs
  • From: yehuda ben-shimol <bsyehuda at>
  • Date: Sun, 20 Mar 2005 04:12:18 -0500 (EST)
  • References: <>
  • Reply-to: yehuda ben-shimol <bsyehuda at>
  • Sender: owner-wri-mathgroup at

Hi Mark,
I fully agree with David's remark but I will still try to help
First I recommend to use the Combinatorica package for that purpose.
Start with 
now assume that you have the following adjacency matrix
a = {{Infinity, 1, 2}, {3, Infinity, Infinity}, {4, 2, Infinity}}
which represents a directed and weighted graph
convert it to a graph and copy the edge weights to the edge labels as
the following
g = SetEdgeLabels[g = FromAdjacencyMatrix[a, EdgeWeight, Type -> Directed], 
and now polt it with ShowGraph
On Fri, 18 Mar 2005 05:35:01 -0500 (EST), Erik Itter
<erik.itter at> wrote:
> 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: filling in an array
  • Next by Date: Re: filling in an array
  • Previous by thread: plotting weighted graphs
  • Next by thread: Re: plotting weighted graphs