MAINT: Fix a potential problem in nn_chain linkage algorithm
MAINT: Fix a potential problem in nn_chain linkage algorithm

Also tweak the algorithm to operate exactly as fastcluster does

Stefan-Endres/scipy,scipy/scipy,vigna/scipy,tylerjereddy/scipy,kalvdans/scipy,pbrod/scipy,gertingold/scipy,nmayorov/scipy,mdhaber/scipy,anntzer/scipy,andyfaff/scipy,ilayn/scipy,scipy/scipy,rgommers/scipy,jamestwebber/scipy,pyramania/scipy,WarrenWeckesser/scipy,gfyoung/scipy,arokem/scipy,jjhelmus/scipy,jamestwebber/scipy,pyramania/scipy,gfyoung/scipy,andyfaff/scipy,endolith/scipy,nmayorov/scipy,nmayorov/scipy,Stefan-Endres/scipy,ilayn/scipy,aeklant/scipy,jjhelmus/scipy,zerothi/scipy,lhilt/scipy,aeklant/scipy,dominicelse/scipy,vigna/scipy,Eric89GXL/scipy,grlee77/scipy,vigna/scipy,jor-/scipy,matthew-brett/scipy,apbard/scipy,rgommers/scipy,Stefan-Endres/scipy,lhilt/scipy,nmayorov/scipy,pizzathief/scipy,kalvdans/scipy,jakevdp/scipy,e-q/scipy,anntzer/scipy,jamestwebber/scipy,e-q/scipy,zerothi/scipy,jor-/scipy,dominicelse/scipy,jjhelmus/scipy,dominicelse/scipy,perimosocordiae/scipy,josephcslater/scipy,befelix/scipy,endolith/scipy,person142/scipy,tylerjereddy/scipy,person142/scipy,ilayn/scipy,person142/scipy,gfyoung/scipy,ilayn/scipy,mdhaber/scipy,pizzathief/scipy,pyramania/scipy,lhilt/scipy,kalvdans/scipy,pyramania/scipy,jjhelmus/scipy,anntzer/scipy,aeklant/scipy,pbrod/scipy,kalvdans/scipy,andyfaff/scipy,Eric89GXL/scipy,gfyoung/scipy,zerothi/scipy,aarchiba/scipy,jjhelmus/scipy,grlee77/scipy,mdhaber/scipy,arokem/scipy,endolith/scipy,mdhaber/scipy,Eric89GXL/scipy,mdhaber/scipy,gertingold/scipy,pbrod/scipy,aarchiba/scipy,pbrod/scipy,josephcslater/scipy,WarrenWeckesser/scipy,WarrenWeckesser/scipy,arokem/scipy,nmayorov/scipy,andyfaff/scipy,josephcslater/scipy,Stefan-Endres/scipy,pschella/scipy,matthew-brett/scipy,endolith/scipy,zerothi/scipy,perimosocordiae/scipy,pschella/scipy,jakevdp/scipy,befelix/scipy,aarchiba/scipy,pizzathief/scipy,jamestwebber/scipy,endolith/scipy,scipy/scipy,anntzer/scipy,befelix/scipy,e-q/scipy,mdhaber/scipy,perimosocordiae/scipy,e-q/scipy,pschella/scipy,josephcslater/scipy,apbard/scipy,pbrod/scipy,endolith/scipy,perimosocordiae/scipy,person142/scipy,lhilt/scipy,pizzathief/scipy,pizzathief/scipy,tylerjereddy/scipy,WarrenWeckesser/scipy,jakevdp/scipy,josephcslater/scipy,pbrod/scipy,Stefan-Endres/scipy,ilayn/scipy,perimosocordiae/scipy,apbard/scipy,WarrenWeckesser/scipy,kalvdans/scipy,vigna/scipy,rgommers/scipy,aarchiba/scipy,apbard/scipy,rgommers/scipy,scipy/scipy,gertingold/scipy,pyramania/scipy,lhilt/scipy,scipy/scipy,Stefan-Endres/scipy,grlee77/scipy,arokem/scipy,dominicelse/scipy,jamestwebber/scipy,tylerjereddy/scipy,aeklant/scipy,ilayn/scipy,matthew-brett/scipy,vigna/scipy,perimosocordiae/scipy,aarchiba/scipy,apbard/scipy,zerothi/scipy,grlee77/scipy,scipy/scipy,gfyoung/scipy,matthew-brett/scipy,aeklant/scipy,andyfaff/scipy,jor-/scipy,Eric89GXL/scipy,jakevdp/scipy,anntzer/scipy,pschella/scipy,zerothi/scipy,WarrenWeckesser/scipy,rgommers/scipy,befelix/scipy,gertingold/scipy,jor-/scipy,befelix/scipy,jakevdp/scipy,tylerjereddy/scipy,jor-/scipy,anntzer/scipy,gertingold/scipy,person142/scipy,arokem/scipy,Eric89GXL/scipy,andyfaff/scipy,Eric89GXL/scipy,pschella/scipy,matthew-brett/scipy,grlee77/scipy,e-q/scipy,dominicelse/scipy