#13820: This patch implements the construction of the Johnson graph.
---------------------------------+------------------------------------------
Reporter: slani | Owner: slani
Type: task | Status: needs_work
Priority: major | Milestone: sage-5.6
Component: graph theory | Resolution:
Keywords: Johnson graph | Work issues:
Report Upstream: N/A | Reviewers:
Authors: Uros Slana | Merged in:
Dependencies: | Stopgaps:
---------------------------------+------------------------------------------
Comment (by ncohen):
Hellooooooooo !!
Actually, I was thinking of this :
{{{
def J(n,k):
from sage.combinat.subset import Subsets
from sage.graphs.graph import Graph
g = Graph(name="Johnson graph with parameters "+str(n)+","+str(k))
X = Set(range(n))
g.add_vertices(Subsets(X,k))
# All sets A and B such that A inter B = X and |X| = k-1 are adjacent
# We first iterate over all sets X of cardinality k-1, then build the
sets A and B
for I in Subsets(X,k-1):
elements_left = X-I
# A = I u {x}
# B = I u {y}
for x in elements_left:
for y in elements_left:
# We assume that y>x
if y <= x:
continue
g.add_edge(I+Set([x]),I+Set([y]))
return g
}}}
By the way, a BIG patch #13862 was recently added to Sage which totally
changes the file you touch. `graph_generators.py` is now split into many
files (smallgraphs.py, families.py, platonic_solids.py, ...), and your
patch does not apply to the latest version of Sage, which is 5.6.beta3.
Hence, two solutions :
* Can you install sage 5.6.beta3 and create a patch from this version of
it, so that the release manager can easily add it to Sage ? (in this case
your function should go inside of `families.py`
* Can you produce, on your current version of Sage, a patch containing all
that you did in only one file ? I will then adapt it to 5.6.beta3 myself.
Have fuuuuuuuuuuuuuuuuuuuuuuuuuun ! `;-)`
Nathann
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13820#comment:9>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.