@Test
public void testIntersectingCycles() {

	Node node1 = new Node(1, 1);
	Node node2 = new Node(1, 2);
	Node node3 = new Node(1, 3);
	Node node4 = new Node(1, 4);
	Set<Node> nodes = new HashSet<>(
		Arrays.asList(node1, node2, node3, node4));
	Map<Node, Collection<Node>> nodeMap = GraphUtil.getNodeMap(
		nodes,
		HashMapBuilder.<Node, Collection<Edge>>put(
			node1, Collections.singletonList(new Edge(node1, node2))
		).put(
			node2, Collections.singletonList(new Edge(node2, node3))
		).put(
			node3,
			Arrays.asList(
				new Edge(node3, node1), new Edge(node3, node2),
				new Edge(node3, node4))
		).put(
			node4, Collections.singletonList(new Edge(node4, node2))
		).build());
	Assert.assertEquals(
		Collections.singleton(node3), nodeMap.remove(new Node(0, 0)));
	Assert.assertEquals(
		new HashSet<>(Arrays.asList(node1, node2, node4)),
		nodeMap.remove(node3));
	Assert.assertEquals(
		Collections.singleton(node2), nodeMap.remove(node4));
	Assert.assertTrue(nodeMap.toString(), nodeMap.isEmpty());
}