Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I'm confused. At least in Sage 4.7.1, the adjacency matrix returned by .am() isn't immutable.

sage: G = graphs.DiamondGraph()
sage: m = G.am()
sage: m[2,3] = 99
sage: m
[ 0  1  1  0]
[ 1  0  1  1]
[ 1  1  0 99]
[ 0  1  1  0]
sage: m[:,1] = 17
sage: m
[ 0 17  1  0]
[ 1 17  1  1]
[ 1 17  0 99]
[ 0 17  1  0]
sage: m[:,0] = vector([6,5,4,3])
sage: m
[ 6 17  1  0]
[ 5 17  1  1]
[ 4 17  0 99]
[ 3 17  1  0]

Even assuming it were immutable, making a new copy of it would be a natural thing to do. Could you cut-and-paste exactly what you did and the error message it generated?