Re: A very EZ Question! Make a Graph!
- To: mathgroup at smc.vnet.net
- Subject: [mg60290] Re: A very EZ Question! Make a Graph!
- From: "mumat" <csarami at gmail.com>
- Date: Sat, 10 Sep 2005 06:46:39 -0400 (EDT)
- References: <dfrgc5$fpf$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Dear Bob Thanks for the solution! Now after you make the graph! I ask for the list of vertices of the graph you made for me! I get {{0.309017,0.951057},{-0.809017,0.587785},{-0.809017,-0.587785},{0.309017,-0.951057},{1.,0}} while it must return {1,2,3,4,5}!!! the same for the edge set of the graph! regards, chekad On 9/9/05, Bob Hanlon <hanlonr at cox.net> wrote: Needs["DiscreteMath`Combinatorica`"]; e={{1,2},{2,3},{4,5},{1,4},{2,5}}; am=Table[0,{5},{5}]; ReleaseHold[HoldForm[ am[[Sequence@@#]]= am[[Sequence@@Reverse[#]]]=1]&/@e]; ShowLabeledGraph[g=FromAdjacencyMatrix[am]]; Position[#,1]&/@ToAdjacencyMatrix[g] {{{2}, {4}}, {{1}, {3}, {5}}, {{2}}, {{1}, {5}}, {{2}, {4}}} Bob Hanlon > > From: "mumat" <csarami at gmail.com> To: mathgroup at smc.vnet.net > Date: 2005/09/09 Fri AM 04:07:01 EDT > Subject: [mg60290] [mg60262] A very EZ Question! Make a Graph! > > Hi Everybody, > > I need to make a graph given the vertices and edges. > > let's say: > > Vertex set: V=Range[5]={1,2,3,4,5} > Edge Set: E={{1,2},{2,3},{4,5},{1,4},{2,5}}; > > Also, Is there any funtion that Lists the vertices adjacent to a given > vertex! I mean using the Combinatorica package in Mathematica! > > > I know it might sound stupid, but I could find a solution to this in > Mathematica Manual!!! > > I appreciate your help. > > regards, > > chekad > >