def filter_adjlist(adjlist, focal_col='focal', neighbor_col='neighbor'):
    """
    This dedupes an adjacency list by examining both (a,b) and (b,a) when (a,b) is enountered.
    The removal is done in order of the iteration order of the input adjacency list. So, if a 
    special order of removal is desired, you need to sort the list before this function. 

    Parameters
    ----------
    adjlist     :   pandas DataFrame
                    a dataframe that contains focal and neighbor columns
    focal_col   :   string
                    the name of the column with the focal observation id
    neighbor_col:   string
                    the name of the column with the neighbor observation id

    Returns
    -------
    an adjacency table with reversible entries removed. 
    """
    directed = set(map(tuple, adjlist[[focal_col, neighbor_col]].values))
    undirected = set()
    for tupe in directed:
        if tupe in undirected:
            to_drop_mask = (adjlist[focal_col] == tupe[0]) & (adjlist[
                neighbor_col] == tupe[-1])
            to_drop = adjlist[to_drop_mask]
        elif tuple(reversed(tupe)) in undirected:
            to_drop_mask = (adjlist[focal_col] == tupe[-1]) & (adjlist[
                neighbor_col] == tupe[0])
            to_drop = adjlist[to_drop_mask]
        else:
            undirected.update((tupe,))
            undirected.update(tuple(reversed(tupe)))
            continue
        adjlist = adjlist.drop(to_drop.index)
    return adjlist
