Search code examples
wolfram-mathematicamathematica-8

Combinatorica`PlanarQ doesn't work


 g1=Graph[{UndirectedEdge[a,b]}];
 GraphQ[g1]
 (*
   OUT: True
 *)
   (*Needs["Combinatorica`"]*)
 PlanarQ[g1]
 (*
    OUT: PlanarQ[.-.]
 *)
 Combinatorica`PlanarQ[g1]
 (*
   OUT: Combinatorica`PlanarQ[.-.]
 *)

Why doesn't PlanarQ give back "True" or "False" ?


Solution

  • Your graph is not a Combinatorica graph, rather it is a System graph. You'll need to specify the contexts explicitly.

    Needs["GraphUtilities`"];
    g1 = System`Graph[{UndirectedEdge[a, b]}];
    Combinatorica`PlanarQ[
      GraphUtilities`ToCombinatoricaGraph[g1]]
    

    This returns True but, in general, this process is a pain and rather buggy. I believe that Combinatorica is on the way out and I'd recommend trying to get by without.