Ejemplo n.º 1
0
def test_isomorphism_group_group():
    """
    Testing multiplicities in group vs. group 
    """
    gp1 = Group().fromAdjacencyList("""
    1 R u0 p0 c0
    """)

    gp2 = Group().fromAdjacencyList("""
    multiplicity [2]
    1 R u0 p0 c0
    """)

    gp3 = Group().fromAdjacencyList("""
    1 C u0 p0 c0
    """)

    assert_false(gp1.isSubgraphIsomorphic(gp2))
    assert_false(len(gp1.findSubgraphIsomorphisms(gp2)) > 0)

    assert_true(gp2.isSubgraphIsomorphic(gp1))
    assert_true(len(gp2.findSubgraphIsomorphisms(gp1)) > 0)

    assert_false(gp2.isIdentical(gp1))

    assert_true(gp3.isSubgraphIsomorphic(gp1))
    assert_true(len(gp3.findSubgraphIsomorphisms(gp1)) > 0)
    assert_false(gp3.isSubgraphIsomorphic(gp2))
    assert_false(len(gp3.findSubgraphIsomorphisms(gp2)) > 0)
def test_isomorphism_group_group():
    """
    Testing multiplicities in group vs. group 
    """
    gp1 = Group().fromAdjacencyList("""
    1 R u0 p0 c0
    """)
    
    gp2 = Group().fromAdjacencyList("""
    multiplicity [2]
    1 R u0 p0 c0
    """)
    
    gp3 = Group().fromAdjacencyList("""
    1 C u0 p0 c0
    """)
    
    assert_false(gp1.isSubgraphIsomorphic(gp2))
    assert_false(len(gp1.findSubgraphIsomorphisms(gp2)) > 0)

    assert_true(gp2.isSubgraphIsomorphic(gp1))
    assert_true(len(gp2.findSubgraphIsomorphisms(gp1)) > 0)

    assert_false(gp2.isIdentical(gp1))
    
    assert_true(gp3.isSubgraphIsomorphic(gp1))
    assert_true(len(gp3.findSubgraphIsomorphisms(gp1)) > 0)
    assert_false(gp3.isSubgraphIsomorphic(gp2))    
    assert_false(len(gp3.findSubgraphIsomorphisms(gp2)) > 0)