@Test public void testRemoveRelations() { GraphCycleDetector instance = new GraphCycleDetector(); instance.addRelations("1", Arrays.asList("2", "3", "4")); instance.removeRelations("1", Arrays.asList("3")); instance.removeRelations("1", Arrays.asList("3")); assertThat(instance.getChildToParents().keySet()).hasSize(1); assertThat(instance.getChildToParents().get("1")).containsExactlyInAnyOrder("2", "4"); assertThat(instance.getParentToChildren().keySet()).hasSize(2); assertThat(instance.getParentToChildren().get("2")).containsExactlyInAnyOrder("1"); assertThat(instance.getParentToChildren().get("4")).containsExactlyInAnyOrder("1"); }
public void removeRelations(String child, Collection<String> parents) { for (String parent : parents) { childToParents.removeMapping(child, parent); parentToChildren.removeMapping(parent, child); } }
GraphCycleDetector { public void removeRelations(String child, Collection<String> parents) { for (String parent : parents) { childToParents.removeMapping(child, parent); parentToChildren.removeMapping(parent, child); } } }
GraphCycleDetector { public void removeRelations(String child, Collection<String> parents) { for (String parent : parents) { childToParents.removeMapping(child, parent); parentToChildren.removeMapping(parent, child); } }  }
GraphCycleDetector { public void removeRelations(String child, Collection<String> parents) { for (String parent : parents) { childToParents.removeMapping(child, parent); parentToChildren.removeMapping(parent, child); } }  void addRelations(String child, Collection<String> parents); void removeRelations(String child, Collection<String> parents); Set<String> checkCycles(); }
GraphCycleDetector { public void removeRelations(String child, Collection<String> parents) { for (String parent : parents) { childToParents.removeMapping(child, parent); parentToChildren.removeMapping(parent, child); } }  void addRelations(String child, Collection<String> parents); void removeRelations(String child, Collection<String> parents); Set<String> checkCycles();  }