parser
rewrite graphs, using adjacency list