fix typeof check in Graph.js

This was incorrectly checking that typeof window was not undefined,
which will always return true, as typeof always returns a string.