MathGroup Archive 2009

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

Search the Archive

Re: A newbee to Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg97389] Re: A newbee to Mathematica
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 12 Mar 2009 02:19:56 -0500 (EST)
  • References: <got87g$gel$1@smc.vnet.net> <200903081050.FAA21504@smc.vnet.net>

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}};

g = FromAdjacencyMatrix[am, EdgeWeight]
GraphPlot[g, VertexLabeling -> True, SelfLoopStyle -> True,
 EdgeLabeling -> True,
 EdgeRenderingFunction -> ({Line[#1],
     Inset[am[[#2[[1]], #2[[2]]]], Mean[#1], Automatic,
      Automatic, #[[1]] - #[[2]], Background -> White]} &)]

On Mar 9, 8:02 am, Murray Eisenberg <mur... at math.umass.edu> wrote:
> That plot is not showing the self-loops, nor is it labeling the edges
> with the weights (which is what, I think, the original poster wanted).
>
>
>
> Jens-Peer Kuska wrote:
> > Hi,
>
> > 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}};
>
> > GraphPlot3D[am]
>
> > ??
>
> > Regards
> >   Jens
>
> > Nishant wrote:
> >> Hi I have just started using mathematica,and therefore have a very sil=
ly 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 adj=
acency matrix,with the elements of the matrix showing the weights of each e=
dge as is provided in FromAdjacencyMatrix[g,Edgeweight]
>
> >> Thank you for helping me out
>
> --
> Murray Eisenberg                     mur... at math.umas=
s.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                413 545-2859 (=
W)
> 710 North Pleasant Street            fax   413 545-1801
> Amherst, MA 01003-9305



  • Prev by Date: Re: StringCases and Shortest
  • Next by Date: Re: Re: Piechart labels Mathematica 7
  • Previous by thread: Re: Re: A newbee to Mathematica
  • Next by thread: Re: A newbee to Mathematica