Hi!

While preparing a (short) talk about Categories in Sage [1], I improved a
bit the ``class_graph`` function to supports a class or object as input [2].

It turns out that the result is currently not a graph, but a
dictionary that you then have to convert to a graph using DiGraph.  In
practice, I find this a bit inconvenient. Besides, ``class_graph`` is used
nowhere in the Sage sources. So, does anyone care if I change
``class_graph`` to directly return a graph, as its name states?
That's somewhat backward compatible since DiGraph is idempotent.

{{{
    EXAMPLES:

    We construct the inheritance graph of the classes within a given module::

        sage: from sage.rings.polynomial.padics import 
polynomial_padic_capped_relative_dense, polynomial_padic_flat
        sage: G = class_graph(sage.rings.polynomial.padics); G
        Digraph on 4 vertices
        sage: G.vertices()
        ['Polynomial_generic_dense', 'Polynomial_generic_domain', 
'Polynomial_padic_capped_relative_dense', 'Polynomial_padic_flat']

    We construct the inheritance graph of a given class::

        sage: class_graph(Parent).edges(labels=False)
        [('CategoryObject', 'SageObject'), ('Parent', 'CategoryObject'), 
('SageObject', 'object')]

    We construct the inheritance graph of the class of an object::

        sage: class_graph([1,2,3]).edges(labels=False)
        [('list', 'object')]
}}}

Beware: Nathann is a fast reviewer. So the vote is only open until
tomorrow :-)

Cheers,
                                Nicolas

[1] Slides 87- of http://www.nicolas.thiery.name/Talks/2011-03-31-LRI.pdf
[2] http://trac.sagemath.org/sage_trac/ticket/11108
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to