09.02.2015 Views

Sage Reference Manual: Graph Theory - Mirrors

Sage Reference Manual: Graph Theory - Mirrors

Sage Reference Manual: Graph Theory - Mirrors

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Sage</strong> <strong>Reference</strong> <strong>Manual</strong>: <strong>Graph</strong> <strong>Theory</strong>, Release 6.1.1<br />

sage: P.characteristic_polynomial(laplacian=True)<br />

x^10 - 30*x^9 + 390*x^8 - 2880*x^7 + 13305*x^6 -<br />

39882*x^5 + 77640*x^4 - 94800*x^3 + 66000*x^2 - 20000*x<br />

charpoly(var=’x’, laplacian=False)<br />

Returns the characteristic polynomial of the adjacency matrix of the (di)graph.<br />

Let G be a (simple) graph with adjacency matrix A. Let I be the identity matrix of dimensions the same<br />

as A. The characteristic polynomial of G is defined as the determinant det(xI − A).<br />

Note: characteristic_polynomial and charpoly are aliases and thus provide exactly the<br />

same method.<br />

INPUT:<br />

•x – (default: ’x’) the variable of the characteristic polynomial.<br />

•laplacian – (default: False) if True, use the Laplacian matrix.<br />

See Also:<br />

•kirchhoff_matrix()<br />

•laplacian_matrix()<br />

EXAMPLES:<br />

sage: P = graphs.Petersen<strong>Graph</strong>()<br />

sage: P.characteristic_polynomial()<br />

x^10 - 15*x^8 + 75*x^6 - 24*x^5 - 165*x^4 + 120*x^3 + 120*x^2 - 160*x + 48<br />

sage: P.charpoly()<br />

x^10 - 15*x^8 + 75*x^6 - 24*x^5 - 165*x^4 + 120*x^3 + 120*x^2 - 160*x + 48<br />

sage: P.characteristic_polynomial(laplacian=True)<br />

x^10 - 30*x^9 + 390*x^8 - 2880*x^7 + 13305*x^6 -<br />

39882*x^5 + 77640*x^4 - 94800*x^3 + 66000*x^2 - 20000*x<br />

check_embedding_validity(*args, **kwds)<br />

Deprecated: Use _check_embedding_validity() instead. See trac ticket #15551 for details.<br />

check_pos_validity(*args, **kwds)<br />

Deprecated: Use _check_pos_validity() instead. See trac ticket #15551 for details.<br />

clear()<br />

Empties the graph of vertices and edges and removes name, boundary, associated objects, and position<br />

information.<br />

EXAMPLES:<br />

sage: G=graphs.Cycle<strong>Graph</strong>(4); G.set_vertices({0:’vertex0’})<br />

sage: G.order(); G.size()<br />

4<br />

4<br />

sage: len(G._pos)<br />

4<br />

sage: G.name()<br />

’Cycle graph’<br />

sage: G.get_vertex(0)<br />

’vertex0’<br />

sage: H = G.copy(implementation=’c_graph’, sparse=True)<br />

sage: H.clear()<br />

1.1. Generic graphs 25

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!