Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
trac #18972: Reviewer's commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanncohen committed Aug 20, 2015
1 parent 6bc5cbd commit d9b098a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
34 changes: 16 additions & 18 deletions src/sage/combinat/designs/twographs.py
Expand Up @@ -13,7 +13,7 @@
Conversely, given a two-graph `T`, one can construct a graph
`\Gamma` in the corresponding Seidel switching class with an
isolated vertex `w`. The graph `\Gamma \setminus w` is called
the descendant of `T` w.r.t. `v`.
the :meth:`descendant <TwoGraph.descendant>` descendant of `T` w.r.t. `v`.
`T` is called regular if each two-subset of `[n]` is contained
in the same number alpha of triples of `T`.
Expand Down Expand Up @@ -61,22 +61,27 @@ class TwoGraph(IncidenceStructure):
r"""
Two-graphs class.
A two-graph on `n` points is a 3-uniform hypergraph, i.e. a family
`T \subset \binom {[n]}{3}` of `3`-sets, such that any
`4`-set `S\subset [n]` of size four contains an even number of elements of `T`.
A two-graph on `n` points is a 3-uniform hypergraph, i.e. a family `T
\subset \binom {[n]}{3}` of `3`-sets, such that any `4`-set `S\subset [n]`
of size four contains an even number of elements of `T`. For more
information, see the documentation of the
:mod:`~sage.combinat.designs.twographs` module.
"""
def is_regular_twograph(self, alpha=False, check=False):
"""
returns True if ``self`` is a regular two-graph, i.e. a 2-design
r"""
Tests if the :class:`TwoGraph` is regular, i.e. is a 2-design.
Namely, each pair of elements of :meth:`ground_set` is contained in
exactly ``alpha`` triples.
INPUT:
- ``alpha`` -- (optional, default is False) return the value of ``alpha``, if possible.
- ``check`` -- (optional, default is False), check that we actually have a two-graph.
- ``alpha`` -- (optional, default is ``False``) return the value of
``alpha``, if possible.
- ``check`` -- (optional, default is ``False``), check that we actually have
a two-graph.
EXAMPLES::
Expand Down Expand Up @@ -202,13 +207,6 @@ def twograph_descendant(G, v):
sage: twograph_descendant(T8, v).is_strongly_regular(parameters=True)
(27, 16, 10, 8)
"""
from sage.graphs.graph import Graph
Nv0 = G.neighbors(v)
Nv = frozenset(Nv0)
NonNv0 = filter(lambda x: not x in Nv and x != v, G.vertices())
NonNv = frozenset(NonNv0)
return Graph([Nv0+NonNv0, lambda i, j:
(i in NonNv and j in NonNv and G.has_edge(i,j)) or
(i in Nv and j in Nv and G.has_edge(i,j)) or
(i in Nv and j in NonNv and not G.has_edge(i,j)) or
(j in Nv and i in NonNv and not G.has_edge(i,j))])
G = G.seidel_switching(G.neighbors(v))
G.delete_vertex(v)
return G
6 changes: 3 additions & 3 deletions src/sage/graphs/graph.py
Expand Up @@ -5041,7 +5041,8 @@ def seidel_adjacency_matrix(self, vertices=None):
It is closely related to :meth:`twograph`.
The matrix returned is over the integers. If a different ring is
desired, use either :meth:`sage.matrix.matrix0.Matrix.change_ring` method or :func:`matrix` function.
desired, use either :meth:`sage.matrix.matrix0.Matrix.change_ring`
method or :func:`matrix` function.
INPUT:
Expand Down Expand Up @@ -5100,10 +5101,9 @@ def twograph(self):
Returns the two-graph of ``self``
Returns the :class:`two-graph <sage.combinat.designs.twographs.TwoGraph>` with the triples
`T=\{t \in \binom {V}{3} : \left| \binom {t}{2} \cap E \right| odd \}`
`T=\{t \in \binom {V}{3} : \left| \binom {t}{2} \cap E \right| \text{odd} \}`
where `V` and `E` are vertices and edges of ``self``, respectively.
EXAMPLES::
sage: p=graphs.PetersenGraph()
Expand Down

0 comments on commit d9b098a

Please sign in to comment.