Ticket #12982: trac_12982.reviewer.patch
File trac_12982.reviewer.patch, 5.8 KB (added by , 7 years ago) 


sage/graphs/graph_generators.py
# HG changeset patch # User Keshav Kini <keshav.kini@gmail.com> # Date 1337827744 25200 # Node ID b13b2b869abd0c77273b4d78d832d2c6507d44a7 # Parent 2ef269c738f4d46c2ae845c419472f52807ebfe4 Formatting, fix duplicate doctests diff git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py
a b 4343 4343 4344 4344 return g 4345 4345 4346 def McGeeGraph(self, embedding =2):4346 def McGeeGraph(self, embedding=2): 4347 4347 r""" 4348 4348 Returns the McGee Graph. 4349 4349 4350 See the :wikipedia:`Wikipedia page on the McGee Graph <McGee_graph>`. 4350 See the :wikipedia:`Wikipedia page on the McGee Graph 4351 <McGee_graph>`. 4351 4352 4352 4353 INPUT: 4353 4354 4354  ``embedding``  two embeddings are available, and can be selected by4355 se tting ``embedding`` to 1 or 2.4355  ``embedding``  two embeddings are available, and can be 4356 selected by setting ``embedding`` to 1 or 2. 4356 4357 4357 4358 EXAMPLES:: 4358 4359 … … 4366 4367 sage: g.diameter() 4367 4368 4 4368 4369 sage: g.show() 4369 sage: graphs.McGeeGraph(embedding= 2).show()4370 sage: graphs.McGeeGraph(embedding=1).show() 4370 4371 4371 4372 TESTS:: 4372 4373 … … 4381 4382 15, 25, 21, 31, 51, 25, 23, 9, 17, 51, 35, 29, 21, 51, 4382 4383 39, 33, 9, 51, 51, 47, 33, 19, 51, 21, 29, 21, 31, 39] 4383 4384 4384 g = graphs.LCFGraph(24, [12, 7,7], 8)4385 g = graphs.LCFGraph(24, [12, 7, 7], 8) 4385 4386 g.name('McGee graph') 4386 4387 4387 4388 if embedding == 1: … … 4393 4394 [5, 4, 11, 10, 17, 16, 23, 22], 4394 4395 [3, 12, 9, 18, 15, 0, 21, 6]] 4395 4396 4396 _circle_embedding(g, o[0], radius =1.5)4397 _circle_embedding(g, o[1], radius = 3, shift =.5)4398 _circle_embedding(g, o[2], radius = 2.25, shift =.5)4397 _circle_embedding(g, o[0], radius=1.5) 4398 _circle_embedding(g, o[1], radius=3, shift=.5) 4399 _circle_embedding(g, o[2], radius=2.25, shift=.5) 4399 4400 4400 4401 return g 4402 4401 4403 else: 4402 4404 raise ValueError("The value of embedding must be 1 or 2.") 4403 4405 4404 4405 4406 def MoebiusKantorGraph(self): 4406 4407 """ 4407 4408 Returns a MoebiusKantor Graph. … … 4606 4607 4607 4608 return gg 4608 4609 4609 def NauruGraph(self, embedding =2):4610 def NauruGraph(self, embedding=2): 4610 4611 """ 4611 4612 Returns the Nauru Graph. 4612 4613 4613 See the :wikipedia:`Wikipedia page on the Nauru Graph <Nauru_graph>`. 4614 See the :wikipedia:`Wikipedia page on the Nauru Graph 4615 <Nauru_graph>`. 4614 4616 4615 4617 INPUT: 4616 4618 … … 4629 4631 sage: g.diameter() 4630 4632 4 4631 4633 sage: g.show() 4632 sage: graphs.NauruGraph(embedding= 2).show()4634 sage: graphs.NauruGraph(embedding=1).show() 4633 4635 4634 4636 TESTS:: 4635 4637 … … 4637 4639 Traceback (most recent call last): 4638 4640 ... 4639 4641 ValueError: The value of embedding must be 1 or 2. 4640 sage: graphs.NauruGraph(embedding=1).is_isomorphic(g raphs.NauruGraph())4642 sage: graphs.NauruGraph(embedding=1).is_isomorphic(g) 4641 4643 True 4642 4644 """ 4643 4645 4644 4646 if embedding == 1: 4645 g = graphs.LCFGraph(24, [5, 9,7,7,9,5], 4)4647 g = graphs.LCFGraph(24, [5, 9, 7, 7, 9, 5], 4) 4646 4648 g.name('Nauru Graph') 4647 4649 return g 4648 4650 elif embedding == 2: 4649 g = graphs.GeneralizedPetersenGraph(12, 5)4651 g = graphs.GeneralizedPetersenGraph(12, 5) 4650 4652 g.name("Nauru Graph") 4651 4653 return g 4652 4654 else: … … 4819 4821 4820 4822 def Tutte12Cage(self): 4821 4823 r""" 4822 Returns Tutte's 12Cage 4824 Returns Tutte's 12Cage. 4823 4825 4824 4826 See the :wikipedia:`Wikipedia page on the Tutte 12Cage 4825 4827 <Tutte_12cage>`. … … 4868 4870 sage: g.diameter() 4869 4871 4 4870 4872 sage: g.show() 4871 sage: graphs.TutteCoxeterGraph(embedding =1).show()4873 sage: graphs.TutteCoxeterGraph(embedding=1).show() 4872 4874 4873 4875 TESTS:: 4874 4876 4875 sage: graphs.TutteCoxeterGraph(embedding =3)4877 sage: graphs.TutteCoxeterGraph(embedding=3) 4876 4878 Traceback (most recent call last): 4877 4879 ... 4878 4880 ValueError: The value of embedding must be 1 or 2. 4879 4881 """ 4880 4882 4881 g = graphs.LCFGraph(30, [13, 9,7,7,9,13], 5)4883 g = graphs.LCFGraph(30, [13, 9, 7, 7, 9, 13], 5) 4882 4884 g.name("TutteCoxeter graph") 4883 4885 4884 4886 if embedding == 1: … … 4891 4893 5: [10, 14, 24, 20, 16] 4892 4894 } 4893 4895 4894 _circle_embedding(g, d[0], center = (1,1), radius =.25)4895 _circle_embedding(g, d[1], center = (1,1), radius =.25)4896 _circle_embedding(g, d[2], center = (.8,0), radius = .25, shift =2.5)4897 _circle_embedding(g, d[3], center = (1.2,0), radius =.25)4898 _circle_embedding(g, d[4], center = (1,1), radius = .25, shift =2)4899 _circle_embedding(g, d[5], center = (1,1), radius =.25)4896 _circle_embedding(g, d[0], center=(1, 1), radius=.25) 4897 _circle_embedding(g, d[1], center=(1, 1), radius=.25) 4898 _circle_embedding(g, d[2], center=(.8, 0), radius=.25, shift=2.5) 4899 _circle_embedding(g, d[3], center=(1.2, 0), radius=.25) 4900 _circle_embedding(g, d[4], center=(1, 1), radius=.25, shift=2) 4901 _circle_embedding(g, d[5], center=(1, 1), radius=.25) 4900 4902 4901 4903 return g 4902 4904 … … 4906 4908 else: 4907 4909 raise ValueError("The value of embedding must be 1 or 2.") 4908 4910 4909 4910 4911 4912 4911 def WagnerGraph(self): 4913 4912 """ 4914 4913 Returns the Wagner Graph. 4915 4914 4916 See the :wikipedia:`Wikipedia page on the Wagner Graph <Wagner_graph>`. 4915 See the :wikipedia:`Wikipedia page on the Wagner Graph 4916 <Wagner_graph>`. 4917 4917 4918 4918 EXAMPLES:: 4919 4919