# Ticket #13510: trac_13510.patch

File trac_13510.patch, 4.7 KB (added by ncohen, 8 years ago)
• ## sage/graphs/graph.py

# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1348094921 -7200
 a # these values are possibly the infinity !!!! start_self = start(start_self) if start_self <= self.order() else self.order()+2 start_self = start(start_self) if start_self <= self.order() else self.order()+2 start_complement = start(start_complement) if start_complement <= self.order() else self.order()+2 counter_example = None for i in range(min(start_self, start_complement), self.order()+1,2): # trying in self if i >= start_self: counter_example = self.subgraph_search(graphs.CycleGraph(i), induced = True) if counter_example is not None: break else: return counter_example is None def is_strongly_regular(self, return_parameters=False): def is_strongly_regular(self, parameters=False): r""" Tests whether self is strongly regular. A graph G is said to be strongly regular with parameters (k, \lambda, \mu) if and only if: * G is k-regular A graph G is said to be strongly regular with parameters (n, k, \lambda, \mu) if and only if: * G has n vertices. * G is k-regular. * Any two adjacent vertices of G have \lambda common neighbors. INPUT: - return_parameters (boolean) -- whether to return the triple (k,\lambda,\mu). If return_parameters = False (default), this method only returns True and False answers. If return_parameters=True, the True answers are replaced by triples (k,\lambda,\mu). See definition above. - parameters (boolean) -- whether to return the quadruple (n, k,\lambda,\mu). If parameters = False (default), this method only returns True and False answers. If parameters=True, the True answers are replaced by quadruples (n, k,\lambda,\mu). See definition above. EXAMPLES: sage: g = graphs.PetersenGraph() sage: g.is_strongly_regular() True sage: g.is_strongly_regular(return_parameters = True) (3, 0, 1) sage: g.is_strongly_regular(parameters = True) (10, 3, 0, 1) And Clebsch's graph is too:: sage: g = graphs.ClebschGraph() sage: g.is_strongly_regular() True sage: g.is_strongly_regular(return_parameters = True) (5, 0, 2) sage: g.is_strongly_regular(parameters = True) (16, 5, 0, 2) But Chvatal's graph is not:: if m != inter: return False if return_parameters: return (k,l,m) if parameters: return (self.order(),k,l,m) else: return True
 a [JoynerNguyenCohen2010]_ for descriptions of spanning tree algorithms, including minimum spanning trees. .. SEEALSO:: * :meth:GenericGraph.min_spanning_tree . **Todo** * Rewrite :func:kruskal` to use priority queues. Once Cython has support