Ticket #9714: trac_9714_review.patch

File trac_9714_review.patch, 1.1 KB (added by Nathann Cohen, 11 years ago)
  • sage/graphs/graph.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1327864079 -3600
    # Node ID a8817ed5082bf4e9bdbb7512ee11f4059a8661fa
    # Parent  221417268f2c6cb2b36372244da12fbcf55d3c21
    trac 9714 -- Fixing the "loop" management in the Graph() constructor -- reviewer's patch
    
    diff --git a/sage/graphs/graph.py b/sage/graphs/graph.py
    a b  
    10711071                        positions.append(tuple(NZ))
    10721072                    L = uniq(c.list())
    10731073                    L.sort()
    1074                     desirable = [-1, 0, 1] if len(NZ) == 2 else [0, 1]
    1075                     if data.nrows() == len(desirable) - 1:
    1076                         desirable = filter(lambda i: i != 0, desirable)
     1074
     1075                    if data.nrows() != len(desirable) - 1:
     1076                        desirable = [-1, 0, 1] if len(NZ) == 2 else [0, 1]
     1077                    else:
     1078                        desirable = [-1, 1] if len(NZ) == 2 else [1]
     1079
    10771080                    if L != desirable:
    10781081                        msg += "Each column represents an edge: -1 goes to 1."
    10791082                        assert False