Spending about an hour on debugging I got really close to the source of the 
problem.
The main problem is that DiGraph (and probably Graph also but I did not test 
this) is making the labels unique, even if the labels are not hashable. This 
is very wrong and might lead to really hard to find bugs as these.

The problem is demonstrated below:

sage: G=DiGraph([[0,1,2]],loops=g.allows_loops(),sparse=True) 
sage: G.add_edge(0,1,[])
sage: G.add_edge(0,2,[])        
sage: G.edge_label(0,1) is G.edge_label(0,2)
True

But note that:

sage: [] is []
False

So DiGraph actually discarded the second list and kept the first one and 
used that also for the label of the edge [0,2]. This leads to unpredictable 
results such as:

sage: G.edge_label(0,2).append(3)
sage: G.edge_label(0,1)
[3]

(notice the two edges above are different edges).

The reason why you example breaks of this is because it uses the function:
graph_isom_equivalent_non_edge_labeled_graph
which depends on modifying the labels of a graph.

I don't know if I will have much time to work on this further so it would be 
good if someone took it up from here.

Kind Regards,
Maarten Derickx

ps. don't change the code in graph_isom_equivalent_non_edge_labeled_graph, 
although that is where the error is really coming from, i think the code 
there is correct and I blame the DiGraph for making non hashable things 
unique!

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to