Build graph from the event pattern