GraphTheory - Maple Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/CharacteristicPolynomial

GraphTheory

 CharacteristicPolynomial

 Calling Sequence CharacteristicPolynomial(G, x)

Parameters

 G - undirected graph x - variable or value

Description

 • CharacteristicPolynomial returns the characteristic polynomial of the adjacency matrix of a graph G, as a polynomial in x.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{with}\left(\mathrm{SpecialGraphs}\right):$
 > $P≔\mathrm{Graph}\left(\left\{\left\{1,2\right\},\left\{2,3\right\}\right\}\right)$
 ${P}{:=}{\mathrm{Graph 1: an undirected unweighted graph with 3 vertices and 2 edge\left(s\right)}}$ (1)
 > $\mathrm{CharacteristicPolynomial}\left(P,x\right)$
 ${{x}}^{{3}}{-}{2}{}{x}$ (2)
 > $A≔\mathrm{AdjacencyMatrix}\left(P\right)$
 ${A}{:=}\left[\begin{array}{rrr}{0}& {1}& {0}\\ {1}& {0}& {1}\\ {0}& {1}& {0}\end{array}\right]$ (3)
 > $\mathrm{LinearAlgebra}[\mathrm{CharacteristicPolynomial}]\left(A,x\right)$
 ${{x}}^{{3}}{-}{2}{}{x}$ (4)
 > $G≔\mathrm{ShrikhandeGraph}\left(\right):$
 > $\mathrm{Diameter}\left(G\right)$
 ${2}$ (5)
 > $f≔\mathrm{CharacteristicPolynomial}\left(G,x\right)$
 ${f}{:=}{{x}}^{{16}}{-}{48}{}{{x}}^{{14}}{-}{64}{}{{x}}^{{13}}{+}{768}{}{{x}}^{{12}}{+}{1536}{}{{x}}^{{11}}{-}{5888}{}{{x}}^{{10}}{-}{15360}{}{{x}}^{{9}}{+}{23040}{}{{x}}^{{8}}{+}{81920}{}{{x}}^{{7}}{-}{36864}{}{{x}}^{{6}}{-}{245760}{}{{x}}^{{5}}{-}{32768}{}{{x}}^{{4}}{+}{393216}{}{{x}}^{{3}}{+}{196608}{}{{x}}^{{2}}{-}{262144}{}{x}{-}{196608}$ (6)
 > $\mathrm{eigvals}≔\left\{\mathrm{solve}\left(f\right)\right\}$
 ${\mathrm{eigvals}}{:=}\left\{{-}{2}{,}{2}{,}{6}\right\}$ (7)
 > $\mathrm{numelems}\left(\mathrm{eigvals}\right)$
 ${3}$ (8)

 See Also

## Was this information helpful?

 Please add your Comment (Optional) E-mail Address (Optional) What is ? This question helps us to combat spam