Ask Your Question

Revision history [back]

Why does SAGE 'stall' in this graph calculation?

I was doing a demonstration for an intro graph theory course when it suddenly took a very long time to even look through 10,000 graphs. At home I isolated the troublesome code, which is this:

 sage: for g in graphs(10):
 ....:     x=g.edges();

Removing the x=, I found something surprising, the output stalls for >3min once it gets to the following graph:

[(0, 1, None), (0, 2, None), (0, 3, None), (0, 4, None), (0, 5, None), (0, 6, None), (0, 7, None), (0, 8, None), (1, 3, None), (2, 3, None), (3, 4, None), (3, 5, None), (3, 6, None), (3, 7, None), (3, 8, None), (3, 9, None)]

Moreover on CoCalc [free server] this issue doesn't come up; it happily works through all of the graphs on 10 vertices with no discernable pauses. (Of course it takes a while to get through all 12 million, but I can see with debug statements that it is chugging along.)

Why does SAGE 'stall' in this graph calculation?

I was doing a demonstration for an intro graph theory course when it suddenly took a very long time to even look through 10,000 graphs. At home I isolated the troublesome code, which is this:

 sage: for g in graphs(10):
 ....:     x=g.edges();

Removing the x=, I found something surprising, the output stalls for >3min once it gets to the following graph:

[(0, 1, None), (0, 2, None), (0, 3, None), (0, 4, None), (0, 5, None), (0, 6, None), (0, 7, None), (0, 8, None), (1, 3, None), (2, 3, None), (3, 4, None), (3, 5, None), (3, 6, None), (3, 7, None), (3, 8, None), (3, 9, None)]

Moreover on CoCalc [free [with a free server] this issue doesn't come up; it happily works through all of the graphs on 10 vertices with no discernable pauses. (Of course it takes a while to get through all 12 million, but I can see with debug statements that it is chugging along.)

The calculation pauses at other points but for much more reasonable lengths of time (<5sec).

Any idea what is going on here?

Why does SAGE 'stall' in this graph calculation?

I was doing a demonstration for an intro graph theory course when it suddenly took a very long time to even look through 10,000 graphs. At home I isolated the troublesome code, which is this:

 sage: for g in graphs(10):
 ....:     x=g.edges();

Removing the x=, I found something surprising, the output stalls for >3min once it gets to the following graph:

[(0, 1, None), (0, 2, None), (0, 3, None), (0, 4, None), (0, 5, None), (0, 6, None), (0, 7, None), (0, 8, None), (1, 3, None), (2, 3, None), (3, 4, None), (3, 5, None), (3, 6, None), (3, 7, None), (3, 8, None), (3, 9, None)]

Moreover on CoCalc [with a free server] this issue doesn't come up; it happily works through all of the graphs on 10 vertices with no discernable pauses. (Of course it takes a while to get through all 12 million, but I can see with debug statements that it is chugging along.)

The calculation pauses at other points but for much more reasonable lengths of time (<5sec).

Any idea what is going on here?