def _to_int_map(network, find_pair):
    """Given a dictionary of edges {'rowN': 'colM', ...}, and a
    function to find the mate node.
    Return a dictionary of {N: M, ...}
    """
    entityMap = {}
    for node in network:
        if node.startswith("row") and len(network[node]):
            paired_node = find_pair(network, node)
            if paired_node is not None:
                entityMap[int(node[3:])] = int(paired_node[3:])
    return entityMap