Build graph of events