test suite test graph
test case basic test()
assert the graphadjacent("foo") • is empty
the graphadd edge("foo", "bar", "edge")
assert the graphadjacent("bar") • is empty
foo : the graphadjacent("foo")
assert !foois empty
assert foois not empty
assert foosize == 1
assert foo elementsfirst == "bar"
test case cycle test()
the graphadd edge("A", "B", "A-B")
the graphadd edge("A", "C", "A-C")
the graphadd edge("C", "D", "C-D")
assert the graphadjacent("A") • size == 2
assert the graphadjacent("B") • size == 0
assert the graphadjacent("C") • size == 1
assert the graphadjacent("D") • size == 0
assert the graphintroduces cycle("A", "A")
assert !the graphintroduces cycle("A", "B")
assert the graphintroduces cycle("B", "A")
assert !the graphintroduces cycle("B", "C")
assert the graphintroduces cycle("C", "A")
assert the graphintroduces cycle("D", "A")
assert the graphintroduces cycle("D", "C")
assert !the graphintroduces cycle("D", "B")