Article

Tests

BeginPackage["Wikicode`PlanarGraph`"]

MaxPlanarQ::usage = "MaxPlanarQ[graph] returns True if the graph is \
maximal planar."

Begin["`Private`"]

MaxPlanarQ[graph_] := 
 PlanarGraphQ[graph] && 
  With[{pos = 
     Select[Position[Normal@AdjacencyMatrix@graph, 
       0], #[[1]] < #[[2]] &], vertex = VertexList[graph], 
    edges = EdgeList[graph]}, val = True;
   Do[If[PlanarGraphQ[
      Graph[Append[edges, 
        vertex[[i[[1]]]] \[UndirectedEdge] vertex[[i[[2]]]]]]], 
     val = False; Break[]], {i, pos}]; Return[val]]

End[]
EndPackage[]

References edit

  • "Little pieces of code for graph and networks theory". Wolfram Community. 14 August 2013. Retrieved 15 August 2013.