Motion retrieval using weighted graph matching