Пример #1
0
 def _graphattr(store=False, *largs, **kargs):
     default = len(largs) + len(kargs) == 0
     try:
         if not default:
             raise NotImplementedError
         return lookup(self._props, name)
     except (KeyError, NotImplementedError):
         a = Graph.__getattribute__(self, name)(*largs, **kargs)
         if default and store:
             update(self._props, attr, d)
         return a
Пример #2
0
 def is_cayley_graph(self, store=False):
     try:
         return lookup(self._props, "is_cayley_graph")
     except (KeyError, NotImplementedError):
         A = self.automorphism_group()
         n = self.order()
         if A.order() == n:
             c = A.is_transitive()
         else:
             c = any(s.order() == n and s.is_transitive() for s in A.conjugacy_classes_subgroups())
         if store:
             update(self._props, "is_cayley_graph", c)
         return c
Пример #3
0
 def is_regular(self, k=None, store=False, **kargs):
     default = len(kargs) == 0
     try:
         if not default:
             raise NotImplementedError
         r = lookup(self._props, "is_regular")
         return r and (True if k is None else k == self.average_degree(store=store))
     except (KeyError, NotImplementedError):
         r = Graph.is_regular(self, k, **kargs)
         if default and store:
             update(self._props, "is_regular", r)
             if r and k is not None:
                 update(self._props, "average_degree", k)
         return r