One way to speed up the verification algorithm is to cache the results of each element being verified. It will take up more memory, but save having to re-parse and traverse the graph for elements if they are referenced more than once (e.g. within a relationship).