def find_root_in_path(graph, path_nodes):
path_graph = graph.subgraph(path_nodes)<EOL>node_in_degree_tuple = sorted([(n, d) for n, d in path_graph.in_degree().items()], key=itemgetter(<NUM_LIT:1>))<EOL>node_out_degree_tuple = sorted([(n, d) for n, d in path_graph.out_degree().items()], key=itemgetter(<NUM_LIT:1>),<EOL>reverse=True)<EOL>tied_root_index = <NUM_LIT:0><EOL>for i in range(<NUM_LIT:0>, (len(node_in_degree_tuple) - <NUM_LIT:1>)):<EOL><INDENT>if node_in_degree_tuple[i][<NUM_LIT:1>] < node_in_degree_tuple[i + <NUM_LIT:1>][<NUM_LIT:1>]:<EOL><INDENT>tied_root_index = i<EOL>break<EOL><DEDENT><DEDENT>if tied_root_index != <NUM_LIT:0>:<EOL><INDENT>root_tuple = max(node_out_degree_tuple[:tied_root_index], key=itemgetter(<NUM_LIT:1>))<EOL><DEDENT>else:<EOL><INDENT>root_tuple = node_in_degree_tuple[<NUM_LIT:0>]<EOL><DEDENT>return path_graph, root_tuple[<NUM_LIT:0>]<EOL>
Find the 'root' of the path -> The node with the lowest out degree, if multiple:
         root is the one with the highest out degree among those with lowest out degree

    :param pybel.BELGraph graph: A BEL Graph
    :param list[tuple] path_nodes: A list of nodes in their order in a path
    :return: A pair of the graph: graph of the path and the root node
    :rtype: tuple[pybel.BELGraph,tuple]