# Ticket #13809: 13809.patch

File 13809.patch, 3.0 KB (added by jdemeyer, 8 years ago)
• ## sage/graphs/generators/families.py

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1356732030 -3600
# Node ID ac63e3e49a67771c4295a891ef0a6bc5c15151bd
# Parent  36fba6c1a13fc3695bb19fb25ea69222f024a5b0
A constructor for folded cube graphs

diff --git a/sage/graphs/generators/families.py b/sage/graphs/generators/families.py```
 a return g ########################################################################### #   Families of Graphs ########################################################################### def BalancedTree(r, h): r""" Returns the perfectly balanced tree of height `h \geq 1`, return r def FoldedCubeGraph(n): r""" Returns the folded cube graph of order `2^{n-1}`. The folded cube graph on `2^{n-1}` vertices can be obtained from a cube graph on `2^n` vertices by merging together opposed vertices. Alternatively, it can be obtained from a cube graph on `2^{n-1}` vertices by adding an edge between opposed vertices. This second construction is the one produced by this method. For more information on folded cube graphs, see the corresponding :wikipedia:`Wikipedia page `. EXAMPLES: The folded cube graph of order five is the Clebsch graph:: sage: fc = graphs.FoldedCubeGraph(5) sage: clebsch = graphs.ClebschGraph() sage: fc.is_isomorphic(clebsch) True """ if n < 1: raise ValueError("The value of n must be at least 2") g = CubeGraph(n-1) g.name("Folded Cube Graph") # Complementing the binary word def complement(x): x = x.replace('0','a') x = x.replace('1','0') x = x.replace('a','1') return x for x in g: if x[0] == '0': g.add_edge(x,complement(x)) return g def FriendshipGraph(n): r""" Returns the friendship graph `F_n`.
• ## sage/graphs/graph_generators.py

`diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py`
 a "CirculantGraph", "CubeGraph", "FibonacciTree", "FoldedCubeGraph", "FriendshipGraph", "FuzzyBallGraph", "GeneralizedPetersenGraph", BubbleSortGraph        = staticmethod(sage.graphs.generators.families.BubbleSortGraph) CirculantGraph         = staticmethod(sage.graphs.generators.families.CirculantGraph) CubeGraph              = staticmethod(sage.graphs.generators.families.CubeGraph) FoldedCubeGraph        = staticmethod(sage.graphs.generators.families.FoldedCubeGraph) DorogovtsevGoltsevMendesGraph = staticmethod(sage.graphs.generators.families.DorogovtsevGoltsevMendesGraph) FriendshipGraph        = staticmethod(sage.graphs.generators.families.FriendshipGraph) FuzzyBallGraph         = staticmethod(sage.graphs.generators.families.FuzzyBallGraph)