Ask Your Question

Revision history [back]

Instead of a dictionary, do a dictionary of dictionaries specifying the labels of the edges. In your example:

sage: D = DiGraph({ 0: {1:123 , 2:234 , 3:12}, 1: {0:'a string', 2:42}, 2: {3:0}, 3: {4:34}, 4: {0:40, 5:11}, 5: {1:123} })

Not that you can label edges by strings as well if you want.

When plotting, if you want to see the labels, you should do:

sage: D.plot(edge_labels=True)

Instead of a dictionary, do a dictionary of dictionaries specifying the labels of the edges. In your example:

sage: D = DiGraph({ 0: {1:123 , 2:234 , 3:12}, 1: {0:'a string', 2:42}, 2: {3:0}, 3: {4:34}, 4: {0:40, 5:11}, 5: {1:123} })

Not Note that you can label edges by strings as well if you want.

When plotting, if you want to see the labels, you should do:

sage: D.plot(edge_labels=True)