Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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" ?

like image 626
Peter Giesecke Avatar asked Jan 19 '23 14:01

Peter Giesecke


2 Answers

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.

like image 71
Mark McClure Avatar answered Jan 24 '23 04:01

Mark McClure


You probably need:

Needs["GraphUtilities`"]
Needs["Combinatorica`"]

cg1 = ToCombinatoricaGraph[g1];

PlanarQ[cg1]

I don't have v8 to check, however.

like image 37
Mr.Wizard Avatar answered Jan 24 '23 05:01

Mr.Wizard