# Ticket #13862: trac_13862-unapply_13809.patch

File trac_13862-unapply_13809.patch, 2.3 KB (added by ncohen, 7 years ago)
• ## sage/graphs/graph_generators.py

```# HG changeset patch
# User Nathann Cohen <nathann.cohen@gmail.com>
# Date 1356731623 -3600
# Node ID 51145c69b91006093210fdd8a455c61cce8e09c9
# Parent  f55d59845a276d045f92132513e3a1ec7206e070
A constructor for folded cube graphs -- unapply 13809

diff --git a/sage/graphs/graph_generators.py b/sage/graphs/graph_generators.py```
 a - :meth:`CompleteBipartiteGraph ` - :meth:`CompleteGraph ` - :meth:`CubeGraph ` - :meth:`FoldedCubeGraph ` - :meth:`FibonacciTree ` - :meth:`FriendshipGraph ` - :meth:`FuzzyBallGraph ` return r def FoldedCubeGraph(self, 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 = self.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': g.add_edge(x,complement(x)) return g def FriendshipGraph(self, n): r""" Returns the friendship graph `F_n`.