loop graph implemented