# [sage-support] Re: Graph canonical form directly on matrices

```Let me add that the situations I care about are n,m <= 20, the entries are
<=5 and the matrices are sparsely filled. An random and typical example is```
```
sage: M = matrix([(0, -1, 0, 0, 0, 0, 0, 1),
....:  (1, 0, 1, 0, 0, 0, 0, 0),
....:  (0, -1, 0, 0, 1, 0, 0, 0),
....:  (0, 0, 0, 0, 0, 1, 0, 0),
....:  (0, 0, -1, 0, 0, 0, 1, 0),
....:  (0, 0, 0, -1, 0, 0, -1, 0),
....:  (0, 0, 0, 0, -1, 1, 0, 0),
....:  (-2, 0, 0, 0, 0, 0, 0, 0),
....:  (-1, 1, 0, 0, 0, 0, 0, 0),
....:  (0, 1, 0, 0, 0, 0, 0, -1),
....:  (0, 1, 0, 1, 0, -1, 0, -1),
....:  (0, 2, -1, 1, 0, -1, 0, -1),
....:  (0, 2, -1, 0, 0, -1, 0, -1),
....:  (0, 2, 0, 0, -1, -1, 0, -1),
....:  (0, 2, 0, 0, -1, 0, -1, -1),
....:  (0, 2, 0, 0, 0, 0, -2, -1)]
....: )
sage: M
[ 0 -1  0  0  0  0  0  1]
[ 1  0  1  0  0  0  0  0]
[ 0 -1  0  0  1  0  0  0]
[ 0  0  0  0  0  1  0  0]
[ 0  0 -1  0  0  0  1  0]
[ 0  0  0 -1  0  0 -1  0]
[ 0  0  0  0 -1  1  0  0]
[-2  0  0  0  0  0  0  0]
[-1  1  0  0  0  0  0  0]
[ 0  1  0  0  0  0  0 -1]
[ 0  1  0  1  0 -1  0 -1]
[ 0  2 -1  1  0 -1  0 -1]
[ 0  2 -1  0  0 -1  0 -1]
[ 0  2  0  0 -1 -1  0 -1]
[ 0  2  0  0 -1  0 -1 -1]
[ 0  2  0  0  0  0 -2 -1]
sage: matrix_canonical_hash(M, 8, 8)
2718289463783950847

--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email