refactored Graph and Node into separate files