       Re: new Graph function + combinatorica: various problems

• To: mathgroup at smc.vnet.net
• Subject: [mg126356] Re: new Graph function + combinatorica: various problems
• From: Murray Eisenberg <murray at math.umass.edu>
• Date: Thu, 3 May 2012 22:22:05 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <ij2v05\$7uu\$1@smc.vnet.net> <201205030835.EAA29999@smc.vnet.net>

```This was discussed in MathGroup about three years ago. Here are some
functions towards a solution that were provided in responses there.

(* Convert Combinatorica type Graph object to the list of rules expected
by GraphPlot *)

RuleListFromGraph[Graph[edges_, vertices_, ___]] :=
Module[{vrules},
vrules = DeleteCases[
Length[vertices]] -> (VertexLabel /.
vertices[[All, 2 ;;]])], _ -> VertexLabel];
Replace[
Transpose[{Rule @@@ (edges[[All, 1]] /. vrules),
EdgeLabel /. edges[[All, 2 ;;]]}], {a_, EdgeLabel} -> a, {1}]]

(* Preserve original coordinates of vertices lost by the above *)
GetVertexCoordinates[Graph[edges_, vertices_, ___]] :=
vertices[[All, 1]]

(* Example *)
g = SetEdgeLabels[
SetVertexLabels[Wheel, Range],
Characters["defabc"]];
GraphPlot[RuleListFromGraph[g], VertexLabeling -> True,
VertexCoordinateRules -> GetVertexCoordinates[g]]

On 5/3/12 4:35 AM, another.schmidt at googlemail.com wrote:
> nice. Can anybody tell me a convenient way to convert an explicit Combinatorica graph g to a System Graph g2 without using wrappers?
> Thanks a lot.
> Jesch
>

--
Murray Eisenberg                     murray at math.umass.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: Integration Problem
• Next by Date: Re: new Graph function + combinatorica: various problems
• Previous by thread: Re: new Graph function + combinatorica: various problems
• Next by thread: Re: new Graph function + combinatorica: various problems