Fix generic_graph.canonical_label() for immutable graphs.