Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

What do you mean by handled? You can make a graph with edge weights in 1,-1:

sage: m = random_matrix(QQ, 5,5, num_bound=1, den_bound=1,density=0.75)
sage: m
[-1  0  0  1  1]
[ 1  0  0  1  0]
[ 0  0  0  1 -1]
[ 0  1  0  1  1]
[ 1  0  1  0  0]
sage: G = Graph(m,format='weighted_adjacency_matrix')
sage: G
Looped graph on 5 vertices
sage: G.edges()
[(0, 0, -1), (0, 3, 1), (0, 4, 1), (1, 3, 1), (2, 3, 1), (2, 4, -1), (3, 3, 1), (3, 4, 1)]
sage: G.weighted()
True
sage: G.incidence_matrix()
[-1 -1  0  0  0  0  0  1]
[ 0  0 -1  0  0  0  0  0]
[ 0  0  0 -1 -1  0  0  0]
[ 0  1  1  0  1 -1  1  0]
[ 1  0  0  1  0  1  0  0]