# 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

b


1393  1393  except: 
1394  1394  return False 
1395  1395  
 1396  def is_triangle_free(self): 
 1397  r""" 
 1398  Returns whether ``self`` is trianglefree 
 1399  
 1400  EXAMPLE: 
 1401  
 1402  The Petersen Graph is trianglefree:: 
 1403  
 1404  sage: g = graphs.PetersenGraph() 
 1405  sage: g.is_triangle_free() 
 1406  True 
 1407  
 1408  or a complete Bipartite Graph:: 
 1409  
 1410  sage: g = graphs.CompleteBipartiteGraph(5,6) 
 1411  sage: g.is_triangle_free() 
 1412  True 
 1413  
 1414  a tripartite graph, though, contains many triangles :: 
 1415  
 1416  sage: g = (3 * graphs.CompleteGraph(5)).complement() 
 1417  sage: g.is_triangle_free() 
 1418  False 
 1419  """ 
 1420  
 1421  from sage.graphs.graph_generators import graphs 
 1422  
 1423  return (self.subgraph_search(graphs.CompleteGraph(3)) is None) 
 1424  
1396  1425  def degree_constrained_subgraph(self, bounds=None, solver=None, verbose=0): 
1397  1426  r""" 
1398  1427  Returns a degreeconstrained subgraph. 