public Node AddOrGetNode(String v) {
        Node newNode = new Node(v);
        if (!nodes.containsKey(v)) {
            nodes.put(v, newNode);
            return newNode;
        } else {
            return nodes.get(v);
        }
    }