A grid defines an image using edges stored in two arrays:
h[x][y]
gives the edge weight fromx,y
tox+1,y
v[x][y]
gives the edge weight fromx,y
tox,y+1
I'm trying to implement Kruskal's algorithm. This is fairly straightforward- I can find implementations online and copy them. The issue is dealing with edges. Specifically; sorting them is confusing.
Is there a better way to store the edges for this take specifically? I want them to be from every pixel to the adjacent pixels. I have the image stored as i[x][y], and the edge weight is just the difference between the image values.