code: @Override
    public void enterGraph(GDLParser.GraphContext graphContext) {
      inGraph = true;
      String variable = getVariable(graphContext.header());
      Graph g;
      if (variable != null && userGraphCache.containsKey(variable)) {
        g = userGraphCache.get(variable);
      } else {
        g = initNewGraph(graphContext);
  
        if (variable != null) {
          userGraphCache.put(variable, g);
        } else {
          variable = String.format(ANONYMOUS_GRAPH_VARIABLE, g.getId());
          autoGraphCache.put(variable, g);
        }
        g.setVariable(variable);
        graphs.add(g);
      }
      currentGraphId = g.getId();
    }
docs: Called when parser enters a graph context.
  
  Checks if the graph has already been created (using its variable). If not, a new graph is
  created and added to the graph cache.
  
  @param graphContext graph context