Opened 3 years ago

Closed 3 years ago

#18986 closed enhancement (fixed)

IncidenceStructure.is_uniform, is_regular, and complement

Reported by: ncohen Owned by:
Priority: major Milestone: sage-6.9
Component: combinatorial designs Keywords:
Cc: dimpase, vdelecroix Merged in:
Authors: Nathann Cohen Reviewers: Dima Pasechnik
Report Upstream: N/A Work issues:
Branch: 55f934b (Commits) Commit: 55f934bedc0da0facf799d1c20472eb9f3dbb211
Dependencies: Stopgaps:

Description

Three methods that we miss. One of them seems to be useful for #18972.

I have been trying to find a way for those methods to tell you at the same time if a hypergraph is k uniform, and the value of k. There is an unfortunate corner-case, but I still think that it is the best way to implement it.

Nathann

Change History (6)

comment:1 Changed 3 years ago by ncohen

  • Branch set to u/ncohen/18986
  • Cc vdelecroix added
  • Commit set to 55f934bedc0da0facf799d1c20472eb9f3dbb211
  • Component changed from combinatorics to combinatorial designs
  • Status changed from new to needs_review

New commits:

55f934btrac #18986: IncidenceStructure.is_uniform, is_regular, and complement

comment:2 Changed 3 years ago by dimpase

  • Reviewers set to Dima Pasechnik
  • Status changed from needs_review to positive_review

LGTM

comment:3 Changed 3 years ago by dimpase

How would I use complement in #1897 ? I need it to be called with uniform=True. How does one write this:

def complement(): # not actual code
    return self.???inherited???.complement(uniform=True)

thanks, Dima

comment:4 follow-up: Changed 3 years ago by dimpase

I tried

   def complement(self):
        return super(self).complement(uniform=True)

and got

sage: p=graphs.CompleteGraph(8).line_graph().twograph()
sage: p.complement()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-cc3764592501> in <module>()
----> 1 p.complement()

/home/dima/software/sage/local/lib/python2.7/site-packages/sage/combinat/designs/twographs.pyc in complement(self)
    141 #        return TwoGraph(filter(lambda x: not list(x) in self.blocks(),
    142 #                                combinations(self.ground_set(), 3)))
--> 143         return super(self).complement(uniform=True)
    144 
    145 """

TypeError: must be type, not TwoGraph

comment:5 in reply to: ↑ 4 Changed 3 years ago by dimpase

Replying to dimpase:

I tried

   def complement(self):
        return super(self).complement(uniform=True)

and got

sage: p=graphs.CompleteGraph(8).line_graph().twograph()
sage: p.complement()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-cc3764592501> in <module>()
----> 1 p.complement()

/home/dima/software/sage/local/lib/python2.7/site-packages/sage/combinat/designs/twographs.pyc in complement(self)
    141 #        return TwoGraph(filter(lambda x: not list(x) in self.blocks(),
    142 #                                combinations(self.ground_set(), 3)))
--> 143         return super(self).complement(uniform=True)
    144 
    145 """

TypeError: must be type, not TwoGraph

Oh, I see, it must be super(TwoGraph,self). Then it works, OK, question answered, sorry for noise.

comment:6 Changed 3 years ago by vbraun

  • Branch changed from u/ncohen/18986 to 55f934bedc0da0facf799d1c20472eb9f3dbb211
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.