Ticket #10953: trac_10953_empty_graph_is_regular.patch

File trac_10953_empty_graph_is_regular.patch, 833 bytes (added by brunellus, 11 years ago)
  • sage/graphs/generic_graph.py

    # HG changeset patch
    # User Lukas Lansky <lansky@kam.mff.cuni.cz>
    # Date 1323736375 0
    # Node ID 7a3c18f6ed26679a9f64081573ac85e06faee475
    # Parent  9e29a3d84c48c399daaf3920bcb8b17273a0e876
    Trac 10953: empty graph is regular
    
    diff --git a/sage/graphs/generic_graph.py b/sage/graphs/generic_graph.py
    a b  
    88458845
    88468846        EXAMPLES::
    88478847
     8848            sage: Graph().is_regular()
     8849            True
    88488850            sage: G = graphs.HoffmanSingletonGraph()
    88498851            sage: G.is_regular()
    88508852            True
     
    88638865            sage: graphs.HouseGraph().is_regular()
    88648866            False
    88658867        """
     8868        if len(self) == 0:
     8869            return True
     8870
    88668871        deg_it = self.degree_iterator()
    88678872        if k is None:
    88688873            k = deg_it.next()