def runTest(self): mg = MyGraph(**self.data["from graph"]) self.assertItemsEqual(mg.vertices(), [1, 2, 3]) self.assertItemsEqual(mg.edges(), [(1, 2, "e"), (2, 3, "f"), (3, 1, "g")]) self.assertItemsEqual(mg.darts, [1, 2, 3, 4, 5, 6]) self.assertEqual(mg.vertex_partition(), { 1: [1, 6], 2: [2, 3], 3: [4, 5] })
def runTest(self): mg = MyGraph(**self.data["isolated vertex"]) self.assertItemsEqual(mg.vertices(), [0, 1]) self.assertItemsEqual(mg.edges(), [(0, 0, 0)])
def runTest(self): mg = MyGraph(**self.data["no labels"]) self.assertItemsEqual(mg.vertices(), [0, 1]) self.assertItemsEqual(mg.edges(), [(0, 1, 0), (1, 0, 1)])
def runTest(self): mg = MyGraph(**self.data["digon"]) self.assertItemsEqual(mg.vertices(), ['u', 'v']) self.assertItemsEqual(mg.edges(), [('u', 'v', 'e'), ('v', 'u', 'f')]) self.assertItemsEqual(mg.darts, [1, 2, 3, 4])
def runTest(self): mg = MyGraph(**self.data["partially labelled graph"]) self.assertItemsEqual(mg.edges(), [(1, 2, 10), (2, 1, 11)])