Ask Your Question

Revision history [back]

I first got

---> 14 from progress.bar import Bar
     15 import pprint
     16 
ImportError: No module named progress.bar

So, i bet that you installed progress from pip, which i did. But then, i got a very different error:

A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
Unfold: 12 faces
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]

Find all length 2 sets from 8 vertices

Find all length 11 sets from 28 edges

Processing |                                | 0/21474180
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-96862f2c002c> in <module>()
    263 
    264     # Unfold
--> 265     planar, G = gray(flatten, all_vertex_pairs)
    266     pp = pprint.PrettyPrinter(indent=Integer(4))
    267     pp.pprint(planar)

<ipython-input-2-96862f2c002c> in gray(flatten, all_vertex_pairs)
     37             s.remove(i)
     38             s.add(j)
---> 39             flag, planar, G = test_edges(all_vertex_pairs, s, flatten)
     40             if flag:
     41                 return planar, G

<ipython-input-2-96862f2c002c> in test_edges(all_v_pairs, possible_unfolding, flatten)
    169         return False, {}, None
    170     test = assign_edges(all_v_pairs, possible_unfolding)
--> 171     planar = planar_representation({}, flatten, test)
    172     if planar == {}:
    173         return False, {}, None

<ipython-input-2-96862f2c002c> in planar_representation(planar, flatten, test_case)
    126     for i in range(len(flatten)):
    127         key = flatten[i]
--> 128         cycle = poly2list(key)
    129         to_delete = []
    130         for j in range(len(cycle)):

<ipython-input-2-96862f2c002c> in poly2list(face)
     85     OUTPUT: A numpy integer array of every edge possible inside a face.
     86     """
---> 87     converted_face = convert(face)
     88     edges = np.array(Combinations(converted_face, Integer(2)).list()).astype(int)
     89     return edges

<ipython-input-2-96862f2c002c> in convert(data)
     69     s_data = s_data.split(",")
     70     for i in range(len(s_data)):
---> 71         s_data[i] = float(s_data[i])
     72     return np.array(s_data)
     73 

ValueError: could not convert string to float: A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices

EDIT : OK got it:

For the graph with a single vertex, the eulerian_circuit method is btoken;

sage: G = Graph()
sage: G.add_vertex(0)
sage: G
Graph on 1 vertex
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-5-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration:

Thanks for reporting, this is now trac ticket 28451


[previous answer in trying to reproduce the issue]

I first got

---> 14 from progress.bar import Bar
     15 import pprint
     16 
ImportError: No module named progress.bar

So, i bet that you installed progress from pip, which i did. But then, i got a very different error:

A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
Unfold: 12 faces
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]

Find all length 2 sets from 8 vertices

Find all length 11 sets from 28 edges

Processing |                                | 0/21474180
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-96862f2c002c> in <module>()
    263 
    264     # Unfold
--> 265     planar, G = gray(flatten, all_vertex_pairs)
    266     pp = pprint.PrettyPrinter(indent=Integer(4))
    267     pp.pprint(planar)

<ipython-input-2-96862f2c002c> in gray(flatten, all_vertex_pairs)
     37             s.remove(i)
     38             s.add(j)
---> 39             flag, planar, G = test_edges(all_vertex_pairs, s, flatten)
     40             if flag:
     41                 return planar, G

<ipython-input-2-96862f2c002c> in test_edges(all_v_pairs, possible_unfolding, flatten)
    169         return False, {}, None
    170     test = assign_edges(all_v_pairs, possible_unfolding)
--> 171     planar = planar_representation({}, flatten, test)
    172     if planar == {}:
    173         return False, {}, None

<ipython-input-2-96862f2c002c> in planar_representation(planar, flatten, test_case)
    126     for i in range(len(flatten)):
    127         key = flatten[i]
--> 128         cycle = poly2list(key)
    129         to_delete = []
    130         for j in range(len(cycle)):

<ipython-input-2-96862f2c002c> in poly2list(face)
     85     OUTPUT: A numpy integer array of every edge possible inside a face.
     86     """
---> 87     converted_face = convert(face)
     88     edges = np.array(Combinations(converted_face, Integer(2)).list()).astype(int)
     89     return edges

<ipython-input-2-96862f2c002c> in convert(data)
     69     s_data = s_data.split(",")
     70     for i in range(len(s_data)):
---> 71         s_data[i] = float(s_data[i])
     72     return np.array(s_data)
     73 

ValueError: could not convert string to float: A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices

EDIT : OK got it:

For the graph with a single vertex, the eulerian_circuit method is btoken;broken;

sage: G = Graph()
sage: G.add_vertex(0)
sage: G
Graph on 1 vertex
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-5-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration:

Thanks for reporting, this is now trac ticket 28451


[previous answer in trying to reproduce the issue]

I first got

---> 14 from progress.bar import Bar
     15 import pprint
     16 
ImportError: No module named progress.bar

So, i bet that you installed progress from pip, which i did. But then, i got a very different error:

A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
Unfold: 12 faces
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]

Find all length 2 sets from 8 vertices

Find all length 11 sets from 28 edges

Processing |                                | 0/21474180
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-96862f2c002c> in <module>()
    263 
    264     # Unfold
--> 265     planar, G = gray(flatten, all_vertex_pairs)
    266     pp = pprint.PrettyPrinter(indent=Integer(4))
    267     pp.pprint(planar)

<ipython-input-2-96862f2c002c> in gray(flatten, all_vertex_pairs)
     37             s.remove(i)
     38             s.add(j)
---> 39             flag, planar, G = test_edges(all_vertex_pairs, s, flatten)
     40             if flag:
     41                 return planar, G

<ipython-input-2-96862f2c002c> in test_edges(all_v_pairs, possible_unfolding, flatten)
    169         return False, {}, None
    170     test = assign_edges(all_v_pairs, possible_unfolding)
--> 171     planar = planar_representation({}, flatten, test)
    172     if planar == {}:
    173         return False, {}, None

<ipython-input-2-96862f2c002c> in planar_representation(planar, flatten, test_case)
    126     for i in range(len(flatten)):
    127         key = flatten[i]
--> 128         cycle = poly2list(key)
    129         to_delete = []
    130         for j in range(len(cycle)):

<ipython-input-2-96862f2c002c> in poly2list(face)
     85     OUTPUT: A numpy integer array of every edge possible inside a face.
     86     """
---> 87     converted_face = convert(face)
     88     edges = np.array(Combinations(converted_face, Integer(2)).list()).astype(int)
     89     return edges

<ipython-input-2-96862f2c002c> in convert(data)
     69     s_data = s_data.split(",")
     70     for i in range(len(s_data)):
---> 71         s_data[i] = float(s_data[i])
     72     return np.array(s_data)
     73 

ValueError: could not convert string to float: A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices

EDIT : OK got it:

For the graph with a single vertex, the eulerian_circuit method is broken;

sage: G = Graph()
sage: G.add_vertex(0)
sage: G
Graph on 1 vertex
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-5-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration:

Or more generally graphs with vertices but no edges;

sage: G = Graph()
sage: G.add_vertices(range(10))
sage: G.eulerian_circuit()
---------------------------------------------------------------------------
StopIteration                             Traceback (most recent call last)
<ipython-input-27-0c288f8b38d6> in <module>()
----> 1 G.eulerian_circuit()

/opt/sagemath/sage-source/local/lib/python2.7/site-packages/sage/graphs/generic_graph.pyc in eulerian_circuit(self, return_vertices, labels, path)
   4001                     edges.append(e if labels else (e[0], e[1]))
   4002             else:
-> 4003                 next_edge = next(g_edge_iter(v))
   4004 
   4005                 if next_edge[0] == v:  # in the undirected case we want to

StopIteration:

Thanks for reporting, this is now trac ticket 28451


[previous answer in trying to reproduce the issue]

I first got

---> 14 from progress.bar import Bar
     15 import pprint
     16 
ImportError: No module named progress.bar

So, i bet that you installed progress from pip, which i did. But then, i got a very different error:

A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 8 vertices
Unfold: 12 faces
[A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices
 A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices]

Find all length 2 sets from 8 vertices

Find all length 11 sets from 28 edges

Processing |                                | 0/21474180
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-2-96862f2c002c> in <module>()
    263 
    264     # Unfold
--> 265     planar, G = gray(flatten, all_vertex_pairs)
    266     pp = pprint.PrettyPrinter(indent=Integer(4))
    267     pp.pprint(planar)

<ipython-input-2-96862f2c002c> in gray(flatten, all_vertex_pairs)
     37             s.remove(i)
     38             s.add(j)
---> 39             flag, planar, G = test_edges(all_vertex_pairs, s, flatten)
     40             if flag:
     41                 return planar, G

<ipython-input-2-96862f2c002c> in test_edges(all_v_pairs, possible_unfolding, flatten)
    169         return False, {}, None
    170     test = assign_edges(all_v_pairs, possible_unfolding)
--> 171     planar = planar_representation({}, flatten, test)
    172     if planar == {}:
    173         return False, {}, None

<ipython-input-2-96862f2c002c> in planar_representation(planar, flatten, test_case)
    126     for i in range(len(flatten)):
    127         key = flatten[i]
--> 128         cycle = poly2list(key)
    129         to_delete = []
    130         for j in range(len(cycle)):

<ipython-input-2-96862f2c002c> in poly2list(face)
     85     OUTPUT: A numpy integer array of every edge possible inside a face.
     86     """
---> 87     converted_face = convert(face)
     88     edges = np.array(Combinations(converted_face, Integer(2)).list()).astype(int)
     89     return edges

<ipython-input-2-96862f2c002c> in convert(data)
     69     s_data = s_data.split(",")
     70     for i in range(len(s_data)):
---> 71         s_data[i] = float(s_data[i])
     72     return np.array(s_data)
     73 

ValueError: could not convert string to float: A 2-dimensional face of a Polyhedron in ZZ^3 defined as the convex hull of 3 vertices