Directly process digraph and shorten the tokenisation algorithm Issue #1