Added method to find self loops in graph