Jason Grout wrote: > William Stein wrote: >> On Wed, May 14, 2008 at 6:57 AM, David Joyner <[EMAIL PROTECTED]> wrote: >>> On Wed, May 14, 2008 at 8:54 AM, Pedro Patricio <[EMAIL PROTECTED]> wrote: >>>> nope, booleans means 1+1=1. >>>> take + as OR and * as AND in the propositional calculus. >> So 1+1 = 1 and 1*1 = 1 and 1*0 = 0 and 1+0 = 1 and 0+0=0? >> That's *not* a ring, so you shouldn't make matrices over it in >> Sage, since in Sage all matrices are over rings. >> >> You could "fake things" by creating a new "the booleans" data >> type but then you are asking for trouble since they aren't a ring. >> >> You could also just make a very simple boolean type with >> the properties you want and make a numpy matrix with >> entries that type. What do you actually want to *do* with >> your boolean matrix? >> > > From your post on sage-edu, it sounds like you just want the adjacency > matrix of the transitive closure of a digraph; is that right? If so, > you might use the transitive closure function. I can't remember if it > is defined for digraphs, but it should be easy to extend.
Sorry, I wasn't thinking. Of course the transitive closure function is defined for digraphs: that's the only case where it's actually interesting. sage: g=DiGraph({0:[1,2], 1:[3], 2:[5,6]}) sage: g.transitive_closure().adjacency_matrix() [0 1 1 1 1 1] [0 0 0 1 0 0] [0 0 0 0 1 1] [0 0 0 0 0 0] [0 0 0 0 0 0] [0 0 0 0 0 0] The transitive closure function isn't very smart right now. It ought to be sped up by looking at the strongly connected components (I don't know if we already have a function to do that, though). Jason --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---