Implementation of growing neural gas algorithm