Ask Your Question
0

signed graphs

asked 2011-10-31 20:42:11 +0200

babulnath gravatar image

updated 2015-01-13 21:46:02 +0200

FrédéricC gravatar image

Can signed graphs be handled by sage ?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2011-10-31 21:27:28 +0200

Jason Grout gravatar image

You can assign weights or labels to edges, so you can have signs that way. I don't know of specific support for signed graphs beyond that. You're welcome to extend things with functions for signed graphs, though!

edit flag offensive delete link more
0

answered 2011-10-31 21:27:16 +0200

DSM gravatar image

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]
edit flag offensive delete link more

Comments

Though according to http://en.wikipedia.org/wiki/Signed_graph#Other_kinds_of_.22signed_graph.22, these are not quite the same thing because of the additional multiplicative structure...

kcrisman gravatar imagekcrisman ( 2011-11-01 12:39:40 +0200 )edit

Ah, I see. It wouldn't be too hard to subclass a graph to add the signed graph-specific functionality, ISTM.

DSM gravatar imageDSM ( 2011-11-01 15:19:08 +0200 )edit

Of course.

kcrisman gravatar imagekcrisman ( 2011-11-01 22:04:45 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2011-10-31 20:42:11 +0200

Seen: 290 times

Last updated: Oct 31 '11