import itertools
import networkx


def check_logic_forms_eq_pair(lfs: list):
    """Check equivalency of logic forms pairwise.

    Parameter:
    lfs (list): dicts of id (int) and a graph (LogicalFormGraph)

    Returns:
    isomorph_pares (list): tuples with ids of equivalent logic forms

    """
    isomorph_pares = []
    for logic_form1, logic_form2 in itertools.combinations(lfs, 2):
        if networkx.is_isomorphic(logic_form1['graph'].graph,
                                  logic_form2['graph'].graph):
            isomorph_pares.append((logic_form1['id'], logic_form2['id']))
    return isomorph_pares