Skip to content

Commit eb49937

Browse files
author
Release Manager
committed
Trac #21931: Hypergraph: is_berge_acyclic method
Wasn't sure, perhaps the method name `is_acyclic` is better? URL: https://trac.sagemath.org/21931 Reported by: pelegm Ticket author(s): Peleg Michaeli, Vipul Gupta Reviewer(s): David Coudert
2 parents e253881 + ff5df19 commit eb49937

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/doc/en/reference/references/index.rst

+4
Original file line numberDiff line numberDiff line change
@@ -2015,6 +2015,10 @@ REFERENCES:
20152015

20162016
**F**
20172017

2018+
.. [Fag1983] Fagin, Ronald. *Degrees of acyclicity for hypergraphs and
2019+
relational database schemes.* Journal of the ACM (JACM) 30.3
2020+
(1983): 514-550.
2021+
20182022
.. [Fayers2010] Matthew Fayers. *An LLT-type algorithm for computing
20192023
higher-level canonical bases*. J. Pure Appl. Algebra
20202024
**214** (2010), no. 12, 2186-2198. :arxiv:`0908.1749v3`.

src/sage/combinat/designs/incidence_structures.py

+34
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,40 @@ def incidence_graph(self,labels=False):
11881188
A = self.incidence_matrix()
11891189
return BipartiteGraph(A)
11901190

1191+
def is_berge_cyclic(self):
1192+
r"""
1193+
Check whether ``self`` is a Berge-Cyclic uniform hypergraph.
1194+
1195+
A `k`-uniform Berge cycle (named after Claude Berge) of length `\ell`
1196+
is a cyclic list of distinct `k`-sets `F_1,\ldots,F_\ell`, `\ell>1`,
1197+
and distinct vertices `C = \{v_1,\ldots,v_\ell\}` such that for each
1198+
`1\le i\le \ell`, `F_i` contains `v_i` and `v_{i+1}` (where `v_{l+1} =
1199+
v_1`).
1200+
1201+
A uniform hypergraph is Berge-cyclic if its incidence graph is cyclic.
1202+
It is called "Berge-acyclic" otherwise.
1203+
1204+
For more information, see [Fag1983]_ and :wikipedia:`Hypergraph`.
1205+
1206+
EXAMPLES::
1207+
1208+
sage: Hypergraph(5, [[1, 2, 3], [2, 3 ,4]]).is_berge_cyclic()
1209+
True
1210+
sage: Hypergraph(6, [[1, 2, 3], [3 ,4, 5]]).is_berge_cyclic()
1211+
False
1212+
1213+
TESTS::
1214+
1215+
sage: Hypergraph(5, [[1, 2, 3], [2, 3]]).is_berge_cyclic()
1216+
Traceback (most recent call last):
1217+
...
1218+
TypeError: Berge cycles are defined for uniform hypergraphs only
1219+
"""
1220+
if not self.is_uniform():
1221+
raise TypeError("Berge cycles are defined for uniform hypergraphs only")
1222+
1223+
return not self.incidence_graph().is_forest()
1224+
11911225
def complement(self,uniform=False):
11921226
r"""
11931227
Return the complement of the incidence structure.

0 commit comments

Comments
 (0)