Ticket #14297: trac-14297-fc.patch

File trac-14297-fc.patch, 2.4 KB (added by chapoton, 7 years ago)
  • sage/graphs/graph.py

    # HG changeset patch
    # User Frederic Chapoton <chapoton at math.univ-lyon1.fr>
    # Date 1364586400 -3600
    # Node ID 3fb2d72773f9b74a2a13b989c32b31e3c8b72e5f
    # Parent  84234f2f136613740756b56ccdbde5753bc3ee13
    trac #14297 complete graphs and their complements are not strongly regular
    
    diff --git a/sage/graphs/graph.py b/sage/graphs/graph.py
    a b class Graph(GenericGraph): 
    22582258
    22592259            * Any two non-adjacent vertices of `G` have `\mu` common neighbors.
    22602260
     2261        By convention, the complete graphs, the graphs with no edges
     2262        and the empty graph are not strongly regular.
     2263
     2264        See :wikipedia:`Strongly regular graph`
     2265
    22612266        INPUT:
    22622267
    22632268        - ``parameters`` (boolean) -- whether to return the quadruple `(n,
    class Graph(GenericGraph): 
    22892294            sage: g = graphs.ChvatalGraph()
    22902295            sage: g.is_strongly_regular()
    22912296            False
     2297
     2298        Complete graphs are not strongly regular. (:trac:`14297`) ::
     2299
     2300            sage: g = graphs.CompleteGraph(5)
     2301            sage: g.is_strongly_regular()
     2302            False
     2303
     2304        Completements of graphs are not strongly regular::
     2305
     2306            sage: g = graphs.CompleteGraph(5).complement()
     2307            sage: g.is_strongly_regular()
     2308            False
     2309
     2310        The empty graph is not strongly regular::
     2311
     2312            sage: g = graphs.EmptyGraph()
     2313            sage: g.is_strongly_regular()
     2314            False
    22922315        """
    22932316        degree = self.degree()
     2317        if len(degree) == 0: # the empty graph
     2318            return False
    22942319        k = degree[0]
    22952320        if not all(d == k for d in degree):
    22962321            return False
    22972322
     2323        if k == 0: # graphs with no edges
     2324            return False
     2325
    22982326        if self.is_clique():
    2299             l = self.order()-2
    2300             m = 0
    2301         elif self.size() == 0:
    2302             l = 0
    2303             m = 0
     2327            return False
    23042328        else:
    23052329            l = m = None
    23062330            for u in self:
    class Graph(GenericGraph): 
    23242348                            if m != inter:
    23252349                                return False
    23262350
    2327             if parameters:
    2328                 return (self.order(),k,l,m)
    2329             else:
    2330                 return True
     2351        if parameters:
     2352            return (self.order(),k,l,m)
     2353        else:
     2354            return True
    23312355
    23322356    def odd_girth(self):
    23332357        r"""