def valid_path(adjList, path):
    """
    Check path goes from node to node following existing edges.

    Arguments:
        AdjList (list): Graph adjacency list
        path (list): The list of node ids that define the path

    Returns:
        Bool: True valid, false otherwise
    """
    max_node = len(adjList)-1

    # Check all nodes with in 0-max_node
    for n in path:
        assert isinstance(n, int)
        assert 0<=n<=max_node

    if len(path) == 1:
        return

    # Check all path edges exist
    prev = path[0]
    for n in path[1:]:
        if n not in adjList[prev]:
            return False
        else:
            prev=n

    return True