My solution for graph:
  1. lexer
  2. parser
  3. syntax tree classes

My solution for edges:

  1. lexer
  2. parser

The edges solution was simple enough that I could emit the code directly during the parse and hence did not have to create an abstract syntax tree.