updated parser, and subgraph validity checking