Hi folks, I noticed the following inconsistent behaviour while working on ticket #8395 [1]. Given a multigraph G with one self-loop at vertex v, disable loops in G and query the degree of v. This should report the correct degree:
sage: version() 'Sage Version 4.6, Release Date: 2010-10-30' sage: G = Graph({1:[2,2]}); G Multi-graph on 2 vertices sage: G.add_edge(1, 2) sage: G.allow_loops(True); G Looped multi-graph on 2 vertices sage: G.add_edge(1, 1) sage: G.edges(labels=False) [(1, 1), (1, 2), (1, 2), (1, 2)] sage: G.allow_loops(False); G Multi-graph on 2 vertices sage: G.edges(labels=False) [(1, 2), (1, 2), (1, 2)] sage: G.degree(1) 3 But now say we start with G having multiple self-loops at the same vertex v. Disable loops in G and query the degree of v. The reported degree of v is greater than the true degree of v: sage: G = Graph({1:[2,2]}); G Multi-graph on 2 vertices sage: G.add_edge(1, 2) sage: G.allow_loops(True); G Looped multi-graph on 2 vertices sage: G.add_edge(1, 1) sage: G.add_edge(1, 1) sage: G.edges(labels=False) [(1, 1), (1, 1), (1, 2), (1, 2), (1, 2)] sage: G.allow_loops(False); G Multi-graph on 2 vertices sage: G.edges(labels=False) [(1, 2), (1, 2), (1, 2)] sage: G.degree(1) 4 I just spent an hour looking into this issue and suspect that the problem may lie in the method SparseGraph.del_arc_label_unsafe() of the module sage/graphs/base/sparse_graph.pyx But I can't pinpoint where the exact problem is. Any help is appreciated. [1] http://trac.sagemath.org/sage_trac/ticket/8395 -- Regards Minh Van Nguyen -- 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