Hi Simon!

On Wed, Jan 26, 2011 at 09:17:09AM -0800, Simon King wrote:
> Anyway. My aim is to implement finite-dimensional quotients of path
> algebras as part of a project to compute modular cohomology rings of
> basic algebras.

Cool! That's a feature we will have a use for :-)

See also this thread:

http://groups.google.com/group/sage-combinat-devel/browse_thread/thread/5dc980d086eb5a27/

> A path algebra should be a unique parent, associated with a base
> ring and a labeled multi-digraph with loops. But since the graphs
> themselves are not hashable, I guess one has to use some unique
> description for them. I guess the ordered tuple of its edges (an
> edge being a triple of start point, end point, and label) is an
> appropriate key, usable in UniqueFactory.

Using CombinatorialFreeModule (and thus UniqueRepresentation), this
could look like (for the full PathAlgebra):

   class PathAlgebra(CombinatorialFreeModule):

       @staticmethod
       def __classcall__(cls, K, graph):
           graph = graph.copy()
           graph._immutable = True
           return super(PathAlgebra, cls).__classcall__(cls, K, graph)

       def __init__(self, K, graph):
           self._graph = graph
           CombinatorialFreeModule.__init__(self, K, GraphPaths(graph) , 
category = GradedAlgebrasWithBasis(K))

       ...

This way, there will be a single line to change when Sage will
officially support for immutable graphs. And in the mean time it will
be reasonably safe since the algebra encapsulates its own private copy
of the graph, reducing the risk of someone inadvertently changing it.

Notes:

 - GraphPaths does not exist yet. Maybe it should be graph.paths().

 - Note: a variant would be to implement instead the path monoid (with
   zero when two paths do not concatenate) of the graph
   GraphPathsMonoid(graph), and just ask for the algebra of this
   monoid.  A little caveat is the proper handling of the zero of the
   monoid, since we want it to be mapped to the 0 of the
   algebra. That's a general feature we want to have for monoids with
   a zero.

Cheers,
                                Nicolas
--
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