# share K neighbor
Share_list=[]
In the range for h (0, len (KNN) :
Share_listC=[]
In the range for g (0, len (KNN)) :
Share_listB=[]
If h!=g:
For v in KNN [h] :
If v in KNN [g] :
Share_listB. Append (v)
Share_listC. Append (share_listB)
The else:
Share_listC. Append (share_listB)
Share_list. Append (share_listC)