Exemplo n.º 1
0
	def test_vr_topsort(self):
	        n = 5
        	partial_order = [(1,2), (2,3), (1,5)]
		g = digraphtools.graph_from_edges(digraphtools.from_partial_order(partial_order))
        	grid = topsort.partial_order_to_grid(partial_order,n)
        	for le in topsort.vr_topsort(n,grid):
			digraphtools.verify_partial_order(digraphtools.iter_partial_order(g), le)
Exemplo n.º 2
0
	def test_vr_topsort(self):
	        n = 5
        	partial_order = [(1,2), (2,3), (1,5)]
		g = digraphtools.graph_from_edges(digraphtools.from_partial_order(partial_order))
        	grid = topsort.partial_order_to_grid(partial_order,n)
        	for le in topsort.vr_topsort(n,grid):
			digraphtools.verify_partial_order(digraphtools.iter_partial_order(g), le)
	def test_verify_partial_order(self):
		g = digraphtools.graph_from_edges([(1,2),(1,3),(2,3)])
		# Will raise an exception if incorrect
		digraphtools.verify_partial_order(digraphtools.iter_partial_order(g), [3,2,1])
		self.assertRaises(digraphtools.OrderViolationException,digraphtools.verify_partial_order, digraphtools.iter_partial_order(g), [3,1,2])