Multidirectional graph that handles cyclic dependencies