Example #1
0
def maximum_clique(G):
    for k in range(n(G), 1, -1):
        for S in combinations(V(G), k):
            if is_clique(G, list(S)) == True:
                return list(S)
def maximum_matching(G):
    for k in range(floor(n(G) / 2), 1, -1):
        for m in combinations(E(G), k):
            if is_matching(G, list(m)) == True:
                return list(m)
Example #3
0
def minimum_dominating(G):
    for k in range(1, n(G)):
        for S in combinations(V(G), k):
            if is_dominating(G, list(S)) == True:
                return list(S)
Example #4
0
def maximum_independent_set(G):
    for k in range (n(G), 1, -1):
        for S in combinations(V(G), k):
            if is_independent(G, list(S)) == True:
                return list(S)