generates the loops in dot format