public static int associated(int from, int end) {
		Queue<Point> q = new LinkedList<Point>();
		BitSet vis = new BitSet(nNodes + 1);
		Point node = new Point(from, -1);
		int next = 0;
		q.add(node);
		vis.set(from, true);
		while (!q.isEmpty()) {
			node = q.poll();
			for (int i = 0; i < ady[node.x].size(); i++) {
				next = ady[node.x].get(i);
				if (next == end)
					return node.y + 1;
				if (!vis.get(next)) {
					q.add(new Point(next, node.y + 1));
					vis.set(next, true);
				}
			}
		}
		return -1;
	}