set_edge_label is setting labels on intended and unintended graph

I generate some graphs and set one's edge labels. When I look at the
next genetated graph, it's edge labels have been changed.
I'm new to Sage/python so perhaps I goofed, but I doubt it.  Thanks
for an explanation or workaround.

I am trying to help my daughter investigate an edge coloring graph
theory problem.  Not the normal edge coloring constraint, though.



See the <<<<<<<<<<<<<<<< I added to the output section.



for G in graphs(3):
  if G.is_connected():
      A = G.adjacency_matrix()
      print "Adjacency Matrix:"
      print A
      print "Edges:"
      for e in G.edge_iterator( labels=True):
          print e
      #G.plot( edge_labels=True )
      print "Setting edge labels..."
      for i in G.edge_iterator( labels=True):
          #print i
          #print type( i )
          G.set_edge_label( i[0], i[1], 'Red' )
      print "Adjacency Matrix:"
      print A
      print "Edges:"
      for j in G.edge_iterator( labels=True):
          print j
      #G.plot( edge_labels=True )
      print "----------------------------"







Adjacency Matrix:
[0 1 1]
[1 0 0]
[1 0 0]
Edges:
(0, 1, None)
(0, 2, None)
Setting edge labels...
Adjacency Matrix:
[0 1 1]
[1 0 0]
[1 0 0]
Edges:
(0, 1, 'Red')
(0, 2, 'Red')
----------------------------
Adjacency Matrix:
[0 1 1]
[1 0 1]
[1 1 0]
Edges:
(0, 1,
'Red')
<<<<<<<<<<<<<<<<
(0, 2,
'Red')
<<<<<<<<<<<<<<<<
(1, 2, None)
Setting edge labels...
Adjacency Matrix:
[0 1 1]
[1 0 1]
[1 1 0]
Edges:
(0, 1, 'Red')
(0, 2, 'Red')
(1, 2, 'Red')
----------------------------

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to