def group_edges(node_prefix, df, group_ids, individual_id):
    """
    Return the edge list from a grouping dataframe, either a Link Plus fuzzy matching or a dataframe, where people are
    connected by appearing in the same family or case.

    :param node_prefix: prefix for the nodes in the edge list.
    :type node_prefix: str.

    :param df: dataframe.
    :type df: Pandas.Dataframe.

    :param group_ids: grouping column names in grouping csv.
    :type group_ids: [str].

    :param individual_id: individual id column name in grouping csv.
    :type individual_id: str.
    """
    groups = df[group_ids+[individual_id]].dropna().drop_duplicates().set_index(group_ids)
    edges = groups.merge(groups, left_index=True, right_index=True)
    return [tuple(map(lambda v: (node_prefix, v), e)) for e in edges.values]