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

ISGCI update, small graphs and recognition #14396

Closed
nathanncohen mannequin opened this issue Apr 2, 2013 · 26 comments
Closed

ISGCI update, small graphs and recognition #14396

nathanncohen mannequin opened this issue Apr 2, 2013 · 26 comments

Comments

@nathanncohen
Copy link
Mannequin

nathanncohen mannequin commented Apr 2, 2013

Helloooooooooooooooo !

This patch is nice ! It adds in Sage the list of smallgraphs used in ISGCI [1], which can now be obtained like that :

sage: d = graph_classes.smallgraphs()
sage: d['P_5']                                                                                                                                                           
Graph on 5 vertices
sage: d['P_5'].is_isomorphic(graphs.PathGraph(5))
True

Now that we have this information, we can do another veeeeeeery nice thing : write a generic recognition algorithm for graph classes defined by a list of forbidden subgraphs.

    sage: g = graphs.PetersenGraph()                                                                                                                                      
    sage: g in graph_classes.ClawFree                                                                                                                                     
    False                                                                                                                                                                 
    sage: g.line_graph() in graph_classes.ClawFree                                                                                                                        
    True                                                                                                                                                                                                                                                                                                                       
    sage: gc = graph_classes.get_class("gc_441")                                                                                                                          
    sage: gc                                                                                                                                                              
    diamond--free graphs                                                                                                                                                  
    sage: graphs.PetersenGraph() in gc                                                                                                                                    
    True   

Of course there is no specific code written for these classes. The list of subgraphs is obtained from the ISGCI database, and each of them is tested.... Nice generic stuff. Of course many graph classes are not defined in such a way, so everything is not done on that front ;-)

And of course, it's an occasion to update the version of ISGCI we ship in Sage.

Howto:

After applying the branch's commits, one has to save graphs-20130920.tar.bz2 to the build/upstream/ directory and run sage -i graphs again.

Nathann

[1] http://www.graphclasses.org/

Updated tarball: https://github.com/sagemath/sage-prod/files/10657524/graphs-20130920.tar.bz2.gz

CC: @nthiery @dimpase @dcoudert @Konrad127123 @sagetrac-elixyre

Component: graph theory

Author: Nathann Cohen

Branch/Commit: b44dcb0

Reviewer: David Coudert

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

@nathanncohen nathanncohen mannequin added this to the sage-5.11 milestone Apr 2, 2013
@nathanncohen

This comment has been minimized.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Apr 2, 2013

Author: Nathann Cohen

@nathanncohen nathanncohen mannequin added the s: needs review label Apr 2, 2013
@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@nathanncohen

This comment has been minimized.

@nathanncohen

This comment has been minimized.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 31, 2013

Branch: u/ncohen/14396

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2013

Commit: 96aac18

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Dec 31, 2013

Branch pushed to git repo; I updated commit sha1. New commits:

96aac18trac #14396: ISGCI update, small graphs and recognition

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Dec 31, 2013

Attachment: graphs-20130920.tar.bz2.gz

@nathanncohen

This comment has been minimized.

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@dcoudert
Copy link
Contributor

Reviewer: David Coudert

@dcoudert
Copy link
Contributor

comment:11

Hello,

I tried this patch and indeed it is cool :)

If I understand well, each time we implement a new membership test to a graph class, we should try to include it in isgci module, right?
Also, is there a simple way for the user to know which recognition tests are available?

A small error:

**********************************************************************
File "src/sage/graphs/isgci.py", line 758, in sage.graphs.isgci.GraphClasses.smallgraphs
Failed example:
    t[0]
Expected:
    {'super': 'gc_2', 'sub': 'gc_1'}
Got:
    {'sub': 'gc_1', 'super': 'gc_2'}
**********************************************************************

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

7857634trac #14396: Merged with 6.5.beta5
f287feetrac #14396: Review

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2015

Changed commit from 96aac18 to f287fee

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 20, 2015

comment:13

Yo !

I tried this patch and indeed it is cool :)

I had almost forgotten about it. Two years old :-P

If I understand well, each time we implement a new membership test to a graph class, we should try to include it in isgci module, right?

Yes, if we want the syntax g in graph_classes.X to use it.

Also, is there a simple way for the user to know which recognition tests are available?

Do you mean "to get the list of all classes defined by forbidden subgraphs"? If so, I don't think so. For specific recognition problems, however, they often correspond to our "Graph.is_*" functions.

A small error:

Fixed.

Nathann

@dcoudert
Copy link
Contributor

comment:14

In the description of method graph_classes.smallgraphs is weird:

sage: graph_classes.smallgraphs?
Type:            CachedMethodCallerNoArgs
String form:     Cached version of <function smallgraphs at 0x1132b62a8>
File:            /Users/dcoudert/sage/local/lib/python2.7/site-packages/sage/misc/cachefunc.so
Definition:      graph_classes.smallgraphs(self)
Docstring:
   Returns a dictionary associating a graph to a graph description
   string.

   Upon the first call, this loads the database from the local XML
   files. Subsequent calls are cached.

   EXAMPLES:

      sage: t = graph_classes.inclusions()
      sage: type(t)
      <type 'list'>
      sage: t[0]
      {'sub': 'gc_1', 'super': 'gc_2'}

Class docstring:
   Utility class that is used by "CachedMethod" to bind a cached
   method to an instance, in the case of a method that does not accept
   any arguments except "self".

   Note: The return value "None" would not be cached. So, if you
     have a method that does not accept arguments and may return
     "None" after a lengthy computation, then "@cached_method" should
     not be used.

   EXAMPLE:

      sage: P.<a,b,c,d> = QQ[]
      sage: I = P*[a,b]
      sage: I.gens
      Cached version of <function gens at 0x...>
      sage: type(I.gens)
      <type 'sage.misc.cachefunc.CachedMethodCallerNoArgs'>
      sage: I.gens is I.gens
      True
      sage: I.gens() is I.gens()
      True

   AUTHOR:

   * Simon King (2011-04)
Init docstring:
   EXAMPLES:

      sage: class Foo:
      ....:     def __init__(self, x):
      ....:         self._x = x
      ....:     @cached_method
      ....:     def f(self):
      ....:         return self._x^2
      sage: a = Foo(2)
      sage: print a.f.get_cache()
      None
      sage: a.f()
      4
      sage: a.f.get_cache()
      4
Call docstring:
   Call the cached method.

   EXAMPLE:

      sage: P.<a,b,c,d> = QQ[]
      sage: I = P*[a,b]
      sage: I.gens()    # indirect doctest
      [a, b]
      sage: I.gens() is I.gens()
      True

Furthermore, the example exposes graph_classes.inclusions() but not graph_classes.smallgraphs().

The rest seems ok.

David.

@nathanncohen

This comment has been minimized.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 20, 2015

comment:16

Yo !

In the description of method graph_classes.smallgraphs is weird:

That's because the method is a cached_method, and the documentation of cached_method is automatically appended to the function's doc. I don't think that it help either :-/

Furthermore, the example exposes graph_classes.inclusions() but not graph_classes.smallgraphs().

Fixed.

Nathann

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2015

Branch pushed to git repo; I updated commit sha1. New commits:

b44dcb0trac #14396: Review

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jan 20, 2015

Changed commit from f287fee to b44dcb0

@dcoudert
Copy link
Contributor

comment:18

Perfect. For me the patch is good to go (installation, tests, doc build, etc.). Cool!

David.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 20, 2015

comment:19

Wow.

Wow.

Reviewed.

Wow.

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 20, 2015

comment:20

(Thanks)

@vbraun
Copy link
Member

vbraun commented Jan 23, 2015

comment:21

Missing link to the new graphs database

@nathanncohen
Copy link
Mannequin Author

nathanncohen mannequin commented Jan 23, 2015

comment:22

It is attached to this ticket. I know we should avoid that, sorry. I did not know that two years ago apparently ^^;

Nathann

@vbraun

This comment has been minimized.

@vbraun
Copy link
Member

vbraun commented Jan 24, 2015

Changed branch from u/ncohen/14396 to b44dcb0

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

4 participants