# Ticket #8927: trac_8927.patch

File trac_8927.patch, 1.4 KB (added by ncohen, 9 years ago)
• ## sage/graphs/graph.py

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1276001333 -7200
# Node ID b68571f25315cdecf993dde376d095a17f2e02e9
# Parent  556bb66e4c6dbb92a4ee37c1750d82a5c6298eeb
trac 8927 -- is_triangle_free

diff -r 556bb66e4c6d -r b68571f25315 sage/graphs/graph.py```
 a except: return False def is_triangle_free(self): r""" Returns whether ``self`` is triangle-free EXAMPLE: The Petersen Graph is triangle-free:: sage: g = graphs.PetersenGraph() sage: g.is_triangle_free() True or a complete Bipartite Graph:: sage: g = graphs.CompleteBipartiteGraph(5,6) sage: g.is_triangle_free() True a tripartite graph, though, contains many triangles :: sage: g = (3 * graphs.CompleteGraph(5)).complement() sage: g.is_triangle_free() False """ from sage.graphs.graph_generators import graphs return (self.subgraph_search(graphs.CompleteGraph(3)) is None) def degree_constrained_subgraph(self, bounds=None, solver=None, verbose=0): r""" Returns a degree-constrained subgraph.