public ArrayList<Integer> getPath(int start, int target, int colour) {
    ArrayList<Integer> tree = new ArrayList<Integer>();
    ArrayList<Integer> parentIndex = new ArrayList<Integer>();
    boolean finished = false;
    tree.add(start);
    parentIndex.add(-1);

    /*
     * iterate through the tree (whilst adding to it)
     */
    for (int index = 0; index < tree.size() && !finished; index++) {
      int node = tree.get(index);
      if (node == target)
        finished = true;
      else {
        ArrayList<Integer> newChildren = getAdjMatrixNeighbours(
                node, colour);
        Collections.shuffle(newChildren);
        for (int child : newChildren)
          if (!tree.contains(child)) {
            tree.add(child);
            parentIndex.add(index);
          }
      }
    }
    ArrayList<Integer> path = new ArrayList<Integer>();

    /*
     * find the path;
     */
    if (finished) {
      int treeIndex = tree.indexOf(target);
      path.add(tree.get(treeIndex));
      int parent = parentIndex.get(treeIndex);

      while (parent != -1) {
        path.add(tree.get(parent));
        parent = parentIndex.get(parent);
      }
    }

    return path;
  }