Fix typeof check in Graph.js

This was incorrectly checking that `typeof window` was not undefined, this will always return true, as typeof always returns a string.

I couldn't see a good place to add a unit test for this change, if you have a suggestion, I'd be happy to add one. Also I have two tests failing on master when I run the tests locally, these fail before and after the application of this patch.