Correctly handle cycles in dpd2dot