Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

An error occurred while reading a graph in Plantri format.

I need to read some planar graphs from this website, but when I try to use read_planar in SageMath, it doesn't work when using 5reg_20-32.pc (Plane 5-regular simple connected graphs with order 20). It seems something is missing.

file = open("5reg_20-32.pc")
s=graphs._read_planar_code(file)
l=[]
for line in s:
       l.append(line)

It gives:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/tmp/ipykernel_6268/2127516145.py in ?()
      1 file = open("5reg_20-32.pc")
      2 s=graphs._read_planar_code(file)
      3 l=[]
----> 4 for line in s:
      5        l.append(line)

/usr/lib/python3.13/site-packages/sage/graphs/graph_generators.py in ?(self, code_input, immutable)
   1582             G = graph.Graph(edges_g, loops=has_loops, immutable=immutable)
   1583 
   1584             if not (G.has_multiple_edges() or has_loops):
   1585                 embed_g = {i + 1: di for i, di in enumerate(g)}
-> 1586                 G.set_embedding(embed_g)
   1587             yield G

/usr/lib/python3.13/site-packages/sage/graphs/generic_graph.py in ?(self, embedding)
   3228             ...
   3229             ValueError: This method is not known to work on graphs with multiedges. Perhaps this method can be updated to handle them, but in the meantime if you want to use it please disallow multiedges using allow_multiple_edges().
   3230         """
   3231         self._scream_if_not_simple()
-> 3232         self._check_embedding_validity(embedding, boolean=False)
   3233         self._embedding = embedding

/usr/lib/python3.13/site-packages/sage/graphs/generic_graph.py in ?(self, embedding, boolean)
   3394             for u in embedding[v]:
   3395                 if not connected(v, u):
   3396                     if boolean:
   3397                         return False
-> 3398                     raise ValueError("{} and {} are not neighbors but {} is in "
   3399                                      "the list associated with {}".format(u, v, u, v))
   3400         return True

ValueError: 10 and 6 are not neighbors but 10 is in the list associated with 6