add readGraph method