MathGroup Archive 2005

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

Search the Archive

Re: A very EZ Question! Make a Graph!

  • To: mathgroup at
  • Subject: [mg60280] Re: A very EZ Question! Make a Graph!
  • From: "Jens-Peer Kuska" <kuska at>
  • Date: Sat, 10 Sep 2005 06:46:33 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <dfrgc5$fpf$>
  • Sender: owner-wri-mathgroup at


and the documentation of the 
DiscretMath`GraphPlot`package and the
"Advanced Documentation" does not help ?
a) don't use  E for the edges because it is used 
by Mathematica
   as the base of the natural logarithm
b) Mathematica repersent a graph as a directed 
graph, if you have a
   undirected graph you have to define the 
undirected edge as two directed
edges = {{1, 2}, {2, 3}, {4, 5}, {1, 4}, {2, 5}};

graphEdges = edges /. {a_Integer, b_Integer} :> 
Sequence @@ {a -> b, b -> a}

c) and than it is easy to find the adjacent edges

adjacent[gedge_, i_] := Select[gedge, First[#] === 
i &]

adjacent[graphEdges, 4]


"mumat" <csarami at> schrieb im Newsbeitrag 
news:dfrgc5$fpf$1 at
| Hi Everybody,
| I need to make a graph given the vertices and 
| 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

  • Prev by Date: Re: Switching to Mac caused 20x slowdown - please help!
  • Next by Date: Re: Numerical integration over half-infinite intervals
  • Previous by thread: Re: A very EZ Question! Make a Graph!
  • Next by thread: Re: A very EZ Question! Make a Graph!