MathGroup Archive 2010

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

Search the Archive

Re: Changing Graph style

On Dec 4, 3:11 am, dr DanW <dmaxwar... at> 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

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


  • 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