IsPlanar - Maple Help

# Online Help

###### All Products    Maple    MapleSim

GraphTheory

 IsPlanar
 test if graph is planar

 Calling Sequence IsPlanar(G) IsPlanar(G, faces)

Parameters

 G - graph faces - (optional) name

Description

 • The IsPlanar command returns true if the graph is planar and false otherwise. If a name such as faces is specified, then this name is assigned the set of lists of the vertices of each face of the graph. The strategy is to use an algorithm by Demoucron, etc. (see Algorithmic Graph Theory by Alan Gibbons).

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $\mathrm{K4}≔\mathrm{CompleteGraph}\left(4\right)$
 ${\mathrm{K4}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 4 vertices and 6 edge\left(s\right)}}$ (1)
 > $\mathrm{IsPlanar}\left(\mathrm{K4},'F'\right)$
 ${\mathrm{true}}$ (2)
 > $F$
 $\left[\left[{3}{,}{1}{,}{2}\right]{,}\left[{2}{,}{1}{,}{4}\right]{,}\left[{3}{,}{2}{,}{4}\right]{,}\left[{4}{,}{1}{,}{3}\right]\right]$ (3)
 > $\mathrm{DrawGraph}\left(\mathrm{K4}\right)$
 > $\mathrm{NumberOfVertices}\left(\mathrm{K4}\right)-\mathrm{NumberOfEdges}\left(\mathrm{K4}\right)+\mathrm{nops}\left(F\right)-\mathrm{nops}\left(\mathrm{ConnectedComponents}\left(\mathrm{K4}\right)\right)-1$
 ${0}$ (4)
 > $P≔\mathrm{PetersenGraph}\left(\right)$
 ${P}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (5)
 > $\mathrm{IsPlanar}\left(P\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{DrawGraph}\left(P\right)$

 See Also