Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: A newbee to Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97220] Re: A newbee to Mathematica
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Sun, 8 Mar 2009 05:53:03 -0500 (EST)
  • References: <got87g$gel$1@smc.vnet.net>

Mathematica has two sets of graph functions, one set natively built-in
in 7 and one delivered by the Combinatorica package. The latter one is
an external development and its graph structures differ from the
internal ones. Mathematica can use the Combinatorica graph structurs,
but not vice versa.

What you are using is a mixture of these worlds. FromAdjacencyMatrix
is from Combinatorica and GraphPlot3D is a built-in function. If it
were the other way around you would need to convert the graph.

The built-in functions can handle adjaceny matrices, so you wouldn't
need Combinatorica if the only thing you want is visualizing a graph.
I believe that the adjacency matrices Mathematica uses are binary and
you are using edge weights.

However, the problem you have follows from typos.

Instead of:

g[FromAdjacencyMatrix[am, EdgeWeight], VertexLabeling -> True,
 EdgeLabeling -> True]
GraphPlot3D[g]

you probably intended to write:

g = FromAdjacencyMatrix[am, EdgeWeight]
GraphPlot3D[g, VertexLabeling -> True, EdgeLabeling -> True]

This works, but there are issues as well.

Syntax coloring shows that EdgeLabeling is not an option of
GraphPlot3D. It is an option of GraphPlot. However, since you haven't
given any edge labels this option doesn't make sense.

Cheers -- Sjoerd


On Mar 7, 9:37 am, Nishant <von... at gmail.com> wrote:
> Hi I have just started using mathematica,and therefore have a very silly =
question that needs an answer.
> I am trying to run this:
> Needs["GraphUtilities`"]
> Needs["Combinatorica`"]
> am = {{1, 0, 1, 2, 0, 1, 2}, {0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 1, 1, 1,
>      1}, {0, 3, 1, 4, 1, 0, 1}, {0, 1, 1, 1, 0, 1, 0}, {1, 1, 1, 0,=
 1,
>      0, 0}, {1, 1, 5, 1, 0, 0, 0}};
>
> MatrixForm[am]
> g[FromAdjacencyMatrix[am, EdgeWeight], VertexLabeling -> True,
>  EdgeLabeling -> True]
> GraphPlot3D[g]
> I am getting this error message:
> GraphPlot3D::grph:Graph:<11,7,Undirected> is not a valid graph.
>
> BASICALLY what I want to do is to generate a 3d graph from a given adjace=
ncy matrix,with the elements of the matrix showing the weights of each edge=
 as is provided in FromAdjacencyMatrix[g,Edgeweight]
>
> Thank you for helping me out



  • Prev by Date: Re: String substitution system
  • Next by Date: Re: Re: Mathematica 7.0.1.0 and some General Comments
  • Previous by thread: Re: A newbee to Mathematica
  • Next by thread: Re: A newbee to Mathematica