keep set of predecessor nodes and write out edges coming from each node