Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error with is_prime

I'm getting an error message when trying to check if a certain graph is prime with the following code:

G=Graph({
     1:[4,9,19,26],
     2:[4,26],
     3:[4,22],
     4:[5,6,7,8,16,17,21,27,1,2,3],
     5:[9,13,22,26,4],
     6:[9,13,26,4],
     7:[9,4],
     8:[9,13,22,4],
     9:[10,11,12,16,20,24,1,5,6,7,8],
     10:[19,9],
     11:[13,9],
     12:[13,19,26,9],
     13:[14,15,16,17,18,27,5,6,8,11,12],
     14:[26,13],
     15:[22,13],
     16:[19,26,4,9,13],
     17:[19,22,4,13],
     18:[19,22,13],
     19:[20,21,23,24,25,1,10,12,16,17,18],
     20:[22,9,19],
     21:[22,4,19],
     22:[23,24,27,3,5,8,15,17,18,20,21],
     23:[26,19,22],
     24:[26,9,19,22],
     25:[26,19],
     26:[27,1,2,5,6,12,14,16,23,24,25],
     27:[4,13,22,26]
     })
G.is_prime()

which gives me the following error message:

Error in lines 30-30
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7233, in is_prime
    D = self.modular_decomposition()
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7199, in modular_decomposition
    return relabel(D)
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in <lambda>
    relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]]
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in <lambda>
    relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]]
KeyError: 27

Error with is_prime

I'm getting an error message when trying to check if a certain graph is prime with the following code:

G=Graph({
     1:[4,9,19,26],
     2:[4,26],
     3:[4,22],
     4:[5,6,7,8,16,17,21,27,1,2,3],
     5:[9,13,22,26,4],
     6:[9,13,26,4],
     7:[9,4],
     8:[9,13,22,4],
     9:[10,11,12,16,20,24,1,5,6,7,8],
     10:[19,9],
     11:[13,9],
     12:[13,19,26,9],
     13:[14,15,16,17,18,27,5,6,8,11,12],
     14:[26,13],
     15:[22,13],
     16:[19,26,4,9,13],
     17:[19,22,4,13],
     18:[19,22,13],
     19:[20,21,23,24,25,1,10,12,16,17,18],
     20:[22,9,19],
     21:[22,4,19],
     22:[23,24,27,3,5,8,15,17,18,20,21],
     23:[26,19,22],
     24:[26,9,19,22],
     25:[26,19],
     26:[27,1,2,5,6,12,14,16,23,24,25],
     27:[4,13,22,26]
     })
G.is_prime()

which gives me the following error message:

Error in lines 30-30
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1013, in execute
    exec compile(block+'\n', '', 'single') in namespace, locals
  File "", line 1, in <module>
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7233, in is_prime
    D = self.modular_decomposition()
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7199, in modular_decomposition
    return relabel(D)
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in <lambda>
    relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]]
  File "/ext/sage/sage-8.1/local/lib/python2.7/site-packages/sage/graphs/graph.py", line 7197, in <lambda>
    relabel = lambda x : (x.node_type, [relabel(_) for _ in x.children]) if x.node_type != NodeType.NORMAL else id_label[x.children[0]]
KeyError: 27