DependencyGraph: Don't choke on recursive import

* Don't choke on recursive import.
* Fixed #853.
* Added unit test.
* More null checks for source-maps.