Ejemplo n.º 1
0
 def testIsGraphicalNonSimple(self):
     # Same as testIsDegreeSequence, but using is_graphical()
     is_degree_sequence = partial(is_graphical, loops=True, multiple=True)
     self.assertTrue(is_degree_sequence([]))
     self.assertTrue(is_degree_sequence([], []))
     self.assertTrue(is_degree_sequence([0]))
     self.assertTrue(is_degree_sequence([0], [0]))
     self.assertFalse(is_degree_sequence([1]))
     self.assertTrue(is_degree_sequence([1], [1]))
     self.assertTrue(is_degree_sequence([2]))
     self.assertFalse(is_degree_sequence([2, 1, 1, 1]))
     self.assertTrue(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, 2]))
     self.assertFalse(is_degree_sequence([2, 1, -2]))
     self.assertFalse(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, -2]))
     self.assertTrue(is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(
         is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3], None))
     self.assertFalse(is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(
         is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
                            [4, 3, 2, 3, 4, 4, 2, 2, 4, 2]))
Ejemplo n.º 2
0
 def testIsDegreeSequence(self):
     self.assertTrue(igr.is_degree_sequence([]))
     self.assertTrue(igr.is_degree_sequence([], []))
     self.assertTrue(igr.is_degree_sequence([0]))
     self.assertTrue(igr.is_degree_sequence([0], [0]))
     self.assertFalse(igr.is_degree_sequence([1]))
     self.assertTrue(igr.is_degree_sequence([1], [1]))
     self.assertTrue(igr.is_degree_sequence([2]))
     self.assertFalse(igr.is_degree_sequence([2, 1, 1, 1]))
     self.assertTrue(igr.is_degree_sequence([2, 1, 1, 1], [1, 1, 1, 2]))
     self.assertFalse(igr.is_degree_sequence([2, 1, -2]))
     self.assertFalse(igr.is_degree_sequence([2, 1, 1, 1], [1, 1, 1, -2]))
     self.assertTrue(igr.is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(igr.is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3], None))
     self.assertFalse(igr.is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(igr.is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
         [4, 3, 2, 3, 4, 4, 2, 2, 4, 2]))
Ejemplo n.º 3
0
 def testIsDegreeSequence(self):
     # Catch and suppress warnings because is_degree_sequence() is now
     # deprecated
     with warnings.catch_warnings():
         warnings.simplefilter("ignore")
         self.assertTrue(is_degree_sequence([]))
         self.assertTrue(is_degree_sequence([], []))
         self.assertTrue(is_degree_sequence([0]))
         self.assertTrue(is_degree_sequence([0], [0]))
         self.assertFalse(is_degree_sequence([1]))
         self.assertTrue(is_degree_sequence([1], [1]))
         self.assertTrue(is_degree_sequence([2]))
         self.assertFalse(is_degree_sequence([2, 1, 1, 1]))
         self.assertTrue(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, 2]))
         self.assertFalse(is_degree_sequence([2, 1, -2]))
         self.assertFalse(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, -2]))
         self.assertTrue(is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
         self.assertTrue(
             is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3], None))
         self.assertFalse(
             is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
         self.assertTrue(
             is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
                                [4, 3, 2, 3, 4, 4, 2, 2, 4, 2]))
Ejemplo n.º 4
0
 def testIsDegreeSequence(self):
     self.assertTrue(is_degree_sequence([]))
     self.assertTrue(is_degree_sequence([], []))
     self.assertTrue(is_degree_sequence([0]))
     self.assertTrue(is_degree_sequence([0], [0]))
     self.assertFalse(is_degree_sequence([1]))
     self.assertTrue(is_degree_sequence([1], [1]))
     self.assertTrue(is_degree_sequence([2]))
     self.assertFalse(is_degree_sequence([2, 1, 1, 1]))
     self.assertTrue(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, 2]))
     self.assertFalse(is_degree_sequence([2, 1, -2]))
     self.assertFalse(is_degree_sequence([2, 1, 1, 1], [1, 1, 1, -2]))
     self.assertTrue(is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(is_degree_sequence(
         [3, 3, 3, 3, 3, 3, 3, 3, 3, 3], None
     ))
     self.assertFalse(is_degree_sequence([3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]))
     self.assertTrue(is_degree_sequence(
         [3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
         [4, 3, 2, 3, 4, 4, 2, 2, 4, 2]
     ))