Ask Your Question

Revision history [back]

This indeed looks like a bug.

As a workaround, test whether the graph has loops before computing the chromatic polynomial.

sage: G = Graph([[1, 1]], multiedges=True, loops=True)
sage: G.has_loops()

Fixing the bug should just amount to special-casing graphs with loops (testing for loops as above) and including a doctest (to prevent the bug from reappearing).