Open A5HU705H opened 3 months ago
I have tracked down the reason for this behavior. It seems that for k nearest neighbors, the adjacency matrix counts out k + 1 neighbors (no idea why) and then instead of counting itself as a neighbor of itself, it assigns this self link to another node (they sort the pairwise distance then kind of OR it with its transpose) this duplicates the self link into two links in the matrix, making it incorrect. A solution would be to simply not count itself and limit to k neighbors only.
I wrote the following piece of sample code, and used
W.todense
inside the lapscore call to print it outthe change for printing W matrix inside lap_score alongside the settings I have used for lapscore
the matrix looks something like this
this doesn't make any sense to me. Why do the first 5 ones connect with all the 7 ones and the last two do not connect with each other? the behavior in case of duplicates is a bit confusing here.