Example #1
0
def test_strongly_connected_components(graph: DirectedGraph) -> None:
    sccs = graph.strongly_connected_components()
    scc_nodes = list(chain(*sccs))
    nodes = list(graph.nodes())

    assert len(scc_nodes) == len(nodes)
    assert set(scc_nodes) == set(nodes)
Example #2
0
def test_strongly_connected_components_is_deterministic(
        graph: DirectedGraph) -> None:
    assert iequal(
        graph.strongly_connected_components(),
        graph.strongly_connected_components(),
        strict=True,
    )