Show function for graphs is not working!
Hi everyone,
Yesterday I wrote a code to generate a random semi-regular graph. The algorithm works in this way: 1)It chooses vertices in numerical order 2)in each step it looks to see if the degree of the vertex is larger or smaller than the specified value for that vertex(which is a for first N/2 and b for second N/2 vertices) 3)it randomly adds an edge or remove one until the degree of vertex become acceptable 4)switches to the next vertex. However when I use show() function to see what is happening in each step, the result is frustrating, the Show() function shows a graph like what it should but the degrees are not associated with the correct vertices! for example most of the time even in the first cycle of the while loop, it should assign 3 edges to the '0' vertex. When I print the neighbours of '0' with "print G[0]" I get '[1,3,4]' but then in the plotted graph neighbours of '0' are '1' and '2' and '5'. I don't understand what is wrong with this Sage?! I am really exhausted of trying! My code is at: http://www.4shared.com/file/ZKT9x0W2/...
Thanks a lot for the helps...