Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Changing Graph style

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114496] Re: Changing Graph style
  • From: Yaroslav Bulatov <yaroslavvb at gmail.com>
  • Date: Sun, 5 Dec 2010 21:56:33 -0500 (EST)
  • References: <idag78$jmk$1@smc.vnet.net> <idd7ks$n8c$1@smc.vnet.net>

On Dec 4, 3:11 am, dr DanW <dmaxwar... at gmail.com> wrote:
> Particularly disappointing is that Graph can't deal with mixed graphs
> (directed and undirected edges in the same graph) or multiple edges
> between  a single pair of nodes.  This limits Graph from working with
> many legitimate and interesting graph problems.  They sure look
> pretty, though.
>
> Daniel

To answer my own question about mixing 2 Graph types, I found the
following approach works out well to avoid ambiguities while giving
full access to both old and new functionality.

1. Use a prefix on graph variables to indicate whether it's
Combinatorica or System graph
2. Use full context path on conflicting functions
3. Use GraphUtilities`ToCombinatoricaGraph and
Combinatorica`ToOrderedPairs to convert between representations

So for instance, you could get shortest paths spanning tree as follows

Needs["Combinatorica`"];
Needs["GraphUtilities`"];
sysGraph = System`GridGraph[{2, 3}];
combGraph = GraphUtilities`ToCombinatoricaGraph[sysGraph];
combTree = Combinatorica`ShortestPathSpanningTree[combGraph, 2];
sysTree =
 System`Graph[
  DirectedEdge @@@
   ToOrderedPairs[ShortestPathSpanningTree[combTree, 2]]]

----
http://stackoverflow.com/users/419116/yaroslav-bulatov


  • Prev by Date: Re: I look for a bi-modal distribution
  • Next by Date: Re: How to use "Apply" to do differentiation ?
  • Previous by thread: Re: Changing Graph style
  • Next by thread: Re: Changing Graph style