Re: A very EZ Question! Make a Graph!

*To*: mathgroup at smc.vnet.net*Subject*: [mg60280] Re: A very EZ Question! Make a Graph!*From*: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>*Date*: Sat, 10 Sep 2005 06:46:33 -0400 (EDT)*Organization*: Uni Leipzig*References*: <dfrgc5$fpf$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi, 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. 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] Regards Jens "mumat" <csarami at gmail.com> schrieb im Newsbeitrag news:dfrgc5$fpf$1 at smc.vnet.net... | 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 |