public void genBFSEdges() {
    ArrayList<Edge> tempEdges = new ArrayList<Edge>();
    Collection<Node> pairedNodes = new HashSet<Node>();
    int radius = 2 * (int) Math.sqrt(widthBound * heightBound / nodes.size());

    // Find all local edges by BFS
    for (Node n : nodes) {
      for (int x = n.x - radius; x < n.x + radius; x++) {
        for (int y = n.y - radius; y < n.y + radius; y++) {
          Node temp = nodeAt(x, y);
          if (temp != null && !temp.equals(n)) {
            tempEdges.add(new Edge(n, temp));
            pairedNodes.add(n);
          }
        }
      }
    }

    // All unpaired nodes make edges to all other nodes
    for (int i = 0; i < nodes.size(); i++) {
      Node n = nodes.get(i);
      if (!pairedNodes.contains(n)) {
        for (int j = i+1; j < nodes.size(); j++){
          tempEdges.add(new Edge(n, nodes.get(j)));
        }
      }
    }


    // ArrayList -> Array
    edges = tempEdges.toArray(edges);
  }