neighbors
A matrix of integers. Non integer matricies will be coerced.
Each row represensts one element, indexed 1 to N. The values in row
i should be the index value of the neighbors of i. Thus, each value should
itself be a valid row index.
fast
If true, only the neibhors given in each row are checked to see if they share minNbrs
neighbors in common. If false, all pairs of elements are compared. For a matrix of size NxM,
the first method yeilds a running time of O(NM), while the second yeilds a running time of O(N^2).
bothDirections
If true, two elements must contain each other in their neighbor list in order to be merged.
If false and fast is true, then only one element must contain the other as a neighbor. If
false and fast is false, than neither element must contain the other as a neighbor, though
in all cases there must still be at least minNbrs
neibhros in common.