changed for loop graph representation