Added read_graph function from comment in codereview