If G is a graph and A = G.am() is its adjacency matrix and B = G.complement().am() is the adjacency matrix of its complement, then A+B should be a 01- matrix. The code below shows that sage does not always share this viewpoint.
Cheers Chris ##### ## ---------------------------------------------------------------------- ## | Sage Version 4.4.4, Release Date: 2010-06-23 | ## | Type notebook() for the GUI, and license() for information. | ## ---------------------------------------------------------------------- ## sage: load whine.sage ## sage: mcl = McL() ## sage: A = mcl.am() ## sage: B = mcl.complement().am() ## sage: A.fcp() ## ## These are what they should be ## ## (x - 112) * (x + 28)^22 * (x - 2)^252 ## sage: B.fcp() ## (x - 162) * (x - 27)^22 * (x + 3)^252 ## ## Here's the problem: C should be a 01-matrix (in fact it should be J- I) ## ## sage: C = A+B ## sage: max(C[0].list()) ## 2 ## ## If use mcl.relabel() before computing A and B, there are no problems. So its the ## complicated vertices that are causing the problem, I expect. ## ## Here's the content of whine.sage: ## def switch(G,sub): H = G.copy() rest = Set(H.vertices()).difference(Set(sub)) for u in sub: for v in rest: if H.has_edge(u,v): H.delete_edge(u,v) else: H.add_edge(u,v) return H def McL(): C = ExtendedBinaryGolayCode() D = C.punctured([0]) words = [ Set(it.support()) for it in D if hamming_weight(it)==7] MG = Graph( [words, lambda a,b: len(a.intersection(b))==1]) MM = MG.copy() MM.add_vertices([0..22]) edges = [ (i,a) for i in [0..22] for a in words if i not in a] MM.add_edges( edges) McL = switch( MM, MM[0]) McL.delete_vertex(0) return McL -- 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