Ticket #13984: trac_13984.patch

File trac_13984.patch, 1.6 KB (added by ncohen, 8 years ago)
  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User Nathann Cohen <nathann.cohen@gmail.com>
    # Date 1358864455 -3600
    # Node ID 3c81cf1f1a81f73b7ba94a5c7a0db4bd299d2c42
    # Parent  46c148d364a31d689e8f2ada71b44cdf611d2651
    Simplification in GenericGraph.is_vertex_transitive
    
    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b  
    1624916249        the partition provided, by default the unit partition of the
    1625016250        vertices of self (thus by default tests for vertex transitivity in
    1625116251        the usual sense).
    16252        
    16253         EXAMPLES::
    16254        
     16252
     16253        EXAMPLES::
     16254
    1625516255            sage: G = Graph({0:[1],1:[2]})
    1625616256            sage: G.is_vertex_transitive()
    1625716257            False
     
    1626716267        """
    1626816268        if partition is None:
    1626916269            partition = [self.vertices()]
     16270
     16271        for p in partition:
     16272            if len(p) == 0:
     16273                continue
     16274            d = self.degree(p[0])
     16275            if not all(self.degree(x) == d for x in p):
     16276                return False
     16277
    1627016278        new_partition = self.automorphism_group(partition,
    1627116279                          verbosity=verbosity, edge_labels=edge_labels,
    1627216280                          order=False, return_group=False, orbits=True)
    16273         for cell in partition:
    16274             for new_cell in new_partition:
    16275                 if cell[0] in new_cell:
    16276                     if any([c not in new_cell for c in cell[1:]]):
    16277                         return False
    16278         return True
     16281
     16282        return (len(partition) == len(new_partition))
    1627916283
    1628016284    def is_hamiltonian(self):
    1628116285        r"""