@Test public void pathMatrix_creates_transitive_closure() { matrix.setEdge(0, 1); matrix.setEdge(1, 2); matrix.setEdge(2, 3); matrix.produceTransitiveClosure(); assertThat(matrix.hasEdge(0, 2), is(true)); assertThat(matrix.hasEdge(0, 3), is(true)); assertThat(matrix.hasEdge(1, 3), is(true)); }
@Test public void transitiveReduction_removes_unnecessary_edges() { matrix.setEdge(0, 1); matrix.setEdge(1, 2); matrix.setEdge(0, 2); matrix.transitiveReduction(); assertThat(matrix.hasEdge(0, 2), is(false)); }