fixed Python code for reading graphs from the disk