public Set<ANode> getConnectedNodes(ANode root, int level) {
		if (level < 0) {
			throw new IllegalArgumentException();
		}
		if (level == 0) {
			return Collections.singleton(root);
		}
		final Set<ANode> result = new HashSet<ANode>();
		if (level == 1) {
			for (ALink link : links) {
				if (link.getNode1() == root) {
					result.add(link.getNode2());
				} else if (link.getNode2() == root) {
					result.add(link.getNode1());
				}

			}
		} else {
			for (ANode n : getConnectedNodes(root, level - 1)) {
				result.addAll(getConnectedNodes(n, 1));
			}
		}
		return Collections.unmodifiableSet(result);
	}