Graph clustering steps functions writting