GraphTheory
CharacteristicPolynomial
compute characteristic polynomial of graph
Calling Sequence
Parameters
Description
Examples
CharacteristicPolynomial(G, x)
G
-
undirected graph
x
variable or value
CharacteristicPolynomial returns the characteristic polynomial of the adjacency matrix of a graph G, as a polynomial in x.
with⁡GraphTheory:
with⁡SpecialGraphs:
P≔Graph⁡1,2,2,3
P≔Graph 1: an undirected graph with 3 vertices and 2 edge(s)
CharacteristicPolynomial⁡P,x
x3−2⁢x
A≔AdjacencyMatrix⁡P
A≔010101010
LinearAlgebraCharacteristicPolynomial⁡A,x
G≔ShrikhandeGraph⁡:
Diameter⁡G
2
f≔CharacteristicPolynomial⁡G,x
f≔x16−48⁢x14−64⁢x13+768⁢x12+1536⁢x11−5888⁢x10−15360⁢x9+23040⁢x8+81920⁢x7−36864⁢x6−245760⁢x5−32768⁢x4+393216⁢x3+196608⁢x2−262144⁢x−196608
eigvals≔solve⁡f
eigvals≔−2,2,6
numelems⁡eigvals
3
See Also
AdjacencyMatrix
GraphSpectrum
LinearAlgebra[CharacteristicPolynomial]
Download Help Document