Implement auto graph layout for cyclic graphs