@@ -1188,6 +1188,40 @@ def incidence_graph(self,labels=False):
1188
1188
A = self .incidence_matrix ()
1189
1189
return BipartiteGraph (A )
1190
1190
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
+
1191
1225
def complement (self ,uniform = False ):
1192
1226
r"""
1193
1227
Return the complement of the incidence structure.
0 commit comments