simple graph maker but with flat map and faster lookup algorithms