def find_path_in_tree(tree, root, target):
    """
    Find path from nodeA to nodeB in tree. We use
    BFS here, which is nothing fancy and will run in O(n)
    for each query

    Parameters
    ----------
    tree : networkx.Graph
           tree we search
    root : hashable
           Starting point of the node type
    target : hashable
           End point of the node type

    Returns
    -------
    path : list
           path from root to target including endpoints
    """
    def tree_traversal(path, node, parent):
        path.append(node)
        children = [neighbor for neighbor in tree.neighbors(node)
                    if neighbor != parent]
        if len(children) == 0:
            return
        if node == target:
            return path
        for child in children:
            path = tree_traversal(path, child, node)
            if path is not None:
                return path
        return

    path = tree_traversal([], root, None)
    return path