def link_in_path(link, node_list):
    """ This function checks if the given link is in the path defined by this node list.
        Works with undirected graphs so checks both link orientations.

        Parameters
        ----------
        link : tuple
            a link expressed in a node pair tuple
        node_list : list
            a path as a list of nodes

        Returns
        -------
        indicator : boolean
            true is the link is in the path, false if not.
    """
    b_link = (link[1], link[0])  # The link in reverse order
    for i in range(len(node_list) - 1):
        p_link = (node_list[i], node_list[i+1])
        if link == p_link:
            return True
        if b_link == p_link:
            return True
    return False