online clustering algorithm implementation