KnightsGraph - Maple Help

# Online Help

###### All Products    Maple    MapleSim

GraphTheory[SpecialGraphs]

 KnightsGraph
 construct knight's graph

 Calling Sequence KnightsGraph(m,n)

Parameters

 m, n - positive integers

Description

 • The KnightsGraph(m,n) command creates the m by n knight's graph on m*n vertices. This is the bipartite graph which represents all legal moves of the knight chess piece on an m by n chessboard.
 • An m by n knight's graph has $4mn-6m-6n+8$ edges when m and n are both greater than 1, and zero edges otherwise.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $R≔\mathrm{KnightsGraph}\left(4,6\right)$
 ${R}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 24 vertices and 44 edge\left(s\right)}}$ (1)
 > $\mathrm{IsPlanar}\left(R\right)$
 ${\mathrm{false}}$ (2)
 > $\mathrm{ChromaticNumber}\left(R\right)$
 ${2}$ (3)
 > $\mathrm{DrawGraph}\left(R\right)$

Compatibility

 • The GraphTheory[SpecialGraphs][KnightsGraph] command was introduced in Maple 2021.
 • For more information on Maple 2021 changes, see Updates in Maple 2021.

 See Also