DependencyGraph: Don't choke on recursive import.
* Fixed #853.
* Added unit test.
Code: Null checks.
Code: Formatting.
Merge pull request #859 from am11/dependency

DependencyGraph: Don't choke on recursive import