Support walking both inverse and forward dependency grahps