@Test
public void testTopologicalSort3() {

	//             --> op1 --
	//            /         \
	//  (source) -           +-> op2 -> op3
	//            \         /
	//             ---------
	
	try {
		JobVertex source = new JobVertex("source");
		JobVertex op1 = new JobVertex("op4");
		JobVertex op2 = new JobVertex("op2");
		JobVertex op3 = new JobVertex("op3");
		
		op1.connectNewDataSetAsInput(source, DistributionPattern.POINTWISE);
		op2.connectNewDataSetAsInput(op1, DistributionPattern.POINTWISE);
		op2.connectNewDataSetAsInput(source, DistributionPattern.POINTWISE);
		op3.connectNewDataSetAsInput(op2, DistributionPattern.POINTWISE);
		
		JobGraph graph = new JobGraph("TestGraph", source, op1, op2, op3);
		List<JobVertex> sorted = graph.getVerticesSortedTopologicallyFromSources();
		
		assertEquals(4,  sorted.size());
		
		assertBefore(source, op1, sorted);
		assertBefore(source, op2, sorted);
		assertBefore(op1, op2, sorted);
		assertBefore(op2, op3, sorted);
	}
	catch (Exception e) {
		e.printStackTrace();
		fail(e.getMessage());
	}
}