def happens_before(G, first, second):
    """Returns true if first happens before second in sequential order."""
    first_doc = G.nodes[first]['doc']
    second_doc = G.nodes[second]['doc']
    return first_doc['end_time'] <= second_doc['start_time']