Hide ASM behind GraphGenerator and adapt algorithm with graph factory