Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speedup in GenericGraph.relabel() and two new options #14000

Closed
nathanncohen mannequin opened this issue Jan 23, 2013 · 17 comments
Closed

Speedup in GenericGraph.relabel() and two new options #14000

nathanncohen mannequin opened this issue Jan 23, 2013 · 17 comments

Comments

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Jan 23, 2013

Because of some weird graphs built by ennemies of The Good Graph People, it seems that most of the work done by GenericGraph.relabel() is totally useless.
This patch adds two optional arguments to this method, which let the users enable/disable tests.


Apply:

  1. attachment: trac_14000.patch
  2. attachment: trac_14000-doctests.patch

CC: @stumpc5 @fchapoton

Component: graph theory

Keywords: relabelling

Author: Nathann Cohen

Reviewer: Anne Schilling

Merged: sage-5.8.beta2

Issue created by migration from https://trac.sagemath.org/ticket/14000

@nathanncohen nathanncohen mannequin added this to the sage-5.8 milestone Jan 23, 2013
@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 23, 2013

Attachment: trac_14000.patch.gz

@nathanncohen nathanncohen mannequin added the s: needs review label Jan 23, 2013
@anneschilling
Copy link

comment:2

Nathann, you need to put in some tests that show how the code works with the new inputs set to False. Also, please post a timing comparison before and after the patch.

Thanks,

Anne

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 22, 2013

comment:3

O_o

Well... The code works the same way. It just does not check some things internally... The output does not change O_o

Nathann

@anneschilling
Copy link

comment:4

I know, but it is still good to put in a test that checks that it works the same ;-)

Replying to @nathanncohen:

O_o

Well... The code works the same way. It just does not check some things internally... The output does not change O_o

Nathann

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 22, 2013

comment:5

Yep yep I'm doing it right now, but the point is that I am not totally sure that it does not produce a memory leak somewhere O_o

Nathann

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 22, 2013

Attachment: trac_14000-doctests.patch.gz

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 22, 2013

comment:6

A timing, just for the show :

Before :

sage: g = graphs.KneserGraph(11,4)
sage: %time g.relabel()           
CPU times: user 0.37 s, sys: 0.00 s, total: 0.37 s
Wall time: 0.37 s

After :

sage: g = graphs.KneserGraph(11,4)
sage: %time g.relabel()           
CPU times: user 0.01 s, sys: 0.00 s, total: 0.01 s
Wall time: 0.01 s

Ready for review again ! ;-)

Nathann

@anneschilling

This comment has been minimized.

@anneschilling
Copy link

Author: Nathann Cohen

@anneschilling
Copy link

Changed keywords from none to relabelling

@anneschilling
Copy link

comment:8

Replying to @nathanncohen:

Yep yep I'm doing it right now, but the point is that I am not totally sure that it does not produce a memory leak somewhere O_o

What does this mean? Do you mean disabling the option is at the user's own risk?

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 23, 2013

comment:9

What does this mean? Do you mean disabling the option is at the user's own risk?

Precisely ! I wrote that in the doctest itself :

"Checking that all vertices have an image can require some time, and this feature can be disabled (at your own risk)"

If you "rename" the vertices of a graph in such a way that two vertices end up having the same name at the end of the procedure, I can totally imagine that some data will be lost on the way :-P

Nathann

@anneschilling
Copy link

comment:10

Ok, then I am happy with your patch!

Anne

@anneschilling
Copy link

Reviewer: Anne Schilling

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Feb 23, 2013

comment:13

Ok, then I am happy with your patch!

Cool. Thanks for reviewing it ! :-D

Nathann

@jdemeyer

This comment has been minimized.

@jdemeyer
Copy link

Merged: sage-5.8.beta2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants