Implement graph for NFA.