Ask Your Question
1

Show function for graphs is not working!

asked 2011-12-16 06:14:46 +0100

Naji gravatar image

updated 2011-12-16 06:23:34 +0100

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...

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2011-12-16 12:54:17 +0100

Jason Grout gravatar image

updated 2012-01-02 12:56:29 +0100

Please see this discussion on sage-devel for discussion about this bug in the notebook and a resolution to the problem.

edit flag offensive delete link more
0

answered 2011-12-16 06:55:04 +0100

Naji gravatar image

Solved! My code has a bug! However I want to mention it is really annoying that the bug of my code results in a bug of show function for SAGE!!

Thanks anyway!

edit flag offensive delete link more

Comments

Can you elaborate on what the bug in your code was, and exactly how that was exposing a bug in the show function? We definitely want to fix any bugs in show.

Jason Grout gravatar imageJason Grout ( 2011-12-16 09:43:14 +0100 )edit
1

Try refreshing the page in your browser; it looks to me like a caching problem. I can reproduce this and am pushing it up to sage-devel.

DSM gravatar imageDSM ( 2011-12-16 10:42:01 +0100 )edit
0

answered 2011-12-31 20:34:27 +0100

Naji gravatar image

@Jason Grout: Sorry for the late reply I didn't notified. I just see it accidentally here!

I find out if your code is buggy(not related to show necessarily) it could result in malfunctioning of Show! or other calls in your program. In this case my code had a bug, but totally unrelated to the Show function but the problem rises in show function( and I don't remember what it was)

@DSM: Yes you are correct many times the problem is related to caching but this one not resolved with refreshing even!!

Thanks guys!

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-12-16 06:14:46 +0100

Seen: 1,501 times

Last updated: Jan 02 '12