scikit-learn/scikit-learn — pull request #875 by AlexandreAbraham (2012-05-31 08:06:03+00:00)
Title: Ward clustering fails if connectivity is not item assignable and there is more than one component

In the ward, prior to launch the algorithm itself, the number of components of the connectivity matrix is checked and if there is more than one, _fix_connectivty is called to join them inplace.

The problem is raised if the connectivity matrix does not support item assignment like coo matrix. It is necessary to transform it into a lil matrix before, so I have put the copy of the matrix before component checking. I have also put apart the non-connected case for the sake of clarity.