Graph(name). If typing a graph6 name directly, quote it as a raw string, for example Graph(r'FC\ng'). Produce the name used here with g.canonical_label(algorithm='sage').graph6_string(). The same names index the characteristic polynomials, the Laplacian polynomials, the chromatic polynomials, and the Tutte polynomials.from sage.graphs.graph import Graph
from sage.rings.rational_field import QQ
G = Graph('FjaHw') # the Moser spindle, by its name here
p = G.laplacian_matrix().charpoly()
n = G.num_verts()
-QQ(n) * QQ(p[2]) / QQ(p[1])
# and the name of a graph you have:
G.canonical_label(algorithm='sage').graph6_string()The generator enumerates connected simple graphs with $1\leq |V(G)|\leq7$ using Sage, takes each graph's canonical_label(algorithm='sage'), and stores the canonical graph6 string. It computes $L(G)=D(G)-A(G)$ exactly over $\mathbb{Z}$, computes $\lambda(G,x)=\det(xI-L(G))$ exactly, and returns $-n c_2/c_1$ as a rational number.
The build checked that the 996 graph6 strings are exactly the keys of the characteristic polynomial table. On every row, the value from Formula (2) agreed with an exact resistance-distance computation from the inverse of $L+J/n$, and applying the formula to the Laplacian polynomial in that table gave the value in this table. Formulas (3), (4), and (5) agreed for every complete graph, path, cycle, and star in the table.