# Ticket #7721: trac_7721.patch

File trac_7721.patch, 2.0 KB (added by ncohen, 11 years ago)
• ## sage/graphs/graph_generators.py

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1261055001 -3600
# Node ID 01a94a133140b387dc49572aed256353c1f5a486
# Parent  964c2f4ce74db0417a771de0b0cfc951b1fab73c
Circuit digraph

diff -r 964c2f4ce74d -r 01a94a133140 sage/graphs/graph_generators.py```
 a - CircularLadderGraph - ClawGraph - CycleGraph - Circuit - DiamondGraph - EmptyGraph - Grid2dGraph - CircularLadderGraph - ClawGraph - CycleGraph - Circuit - DiamondGraph - EmptyGraph - Grid2dGraph raise NotImplementedError, "vertices must be 'strings' or 'vectors'." return graph.DiGraph(butterfly) def Circuit(self,n): r""" Returns the circuit on `n` vertices The circuit is an oriented ``CycleGraph`` EXAMPLE: A circuit is the smallest strongly connected digraph:: sage: circuit = digraphs.Circuit(15) sage: len(circuit.strongly_connected_components()) == 1 True """ if n<0: raise ValueError("The number of vertices must be a positive integer.") from sage.graphs.graph import DiGraph g = DiGraph() g.name("Circuit on "+str(n)+" vertices") if n==0: return g elif n == 1: g.allow_loops(True) g.add_edge(0,0) return g else: g.add_edges([(i,i+1) for i in xrange(n-1)]) g.add_edge(n-1,0) return g def DeBruijn(self,n,k): r""" Returns the De Bruijn diraph with parameters `n,k`.