1 | | We use method `is_directed_acyclic` to search for cycles instead of computing shortest paths. This should have been done long ago as it's faster this way. |

| 1 | We use method `is_directed_acyclic` to find cycles instead of computing shortest paths. This should have been done long ago as it's faster this way. |

| 2 | |

| 3 | Before: |

| 4 | {{{ |

| 5 | sage: D = digraphs.TransitiveTournament(10) |

| 6 | sage: D.add_edges((i+1, i) for i in range(9)) |

| 7 | sage: flow = {e: 1 for e in D.edge_iterator(labels=0)} |

| 8 | sage: %time F = D._build_flow_graph(flow, False) |

| 9 | CPU times: user 1.45 ms, sys: 320 µs, total: 1.77 ms |

| 10 | Wall time: 1.55 ms |

| 11 | }}} |

| 12 | |

| 13 | After: |

| 14 | {{{ |

| 15 | sage: D = digraphs.TransitiveTournament(10) |

| 16 | sage: D.add_edges((i+1, i) for i in range(9)) |

| 17 | sage: flow = {e: 1 for e in D.edge_iterator(labels=0)} |

| 18 | sage: %time F = D._build_flow_graph(flow, False) |

| 19 | CPU times: user 958 µs, sys: 244 µs, total: 1.2 ms |

| 20 | Wall time: 1.02 ms |

| 21 | }}} |