Beispiel #1
0
def test_0():
    sol = Solution()
    assert sol.cloneGraph(None) is None
    g1 = UndirectedGraphNode(2)
    g2 = sol.cloneGraph(g1)
    assert graph_eq(g1, g2)
    g1.label = 3
    assert not graph_eq(g1, g2)
Beispiel #2
0
def test_1():
    sol = Solution()
    n1 = UndirectedGraphNode(1)
    n0 = UndirectedGraphNode(0)
    n2 = UndirectedGraphNode(2)
    n1.neighbors = [n0, n2]
    n0.neighbors = [n1, n2]
    n2.neighbors = [n0, n1, n2]
    c1 = sol.cloneGraph(n1)
    assert graph_eq(n1, c1)
    n0.label = 9
    assert not graph_eq(n1, c1)