read write graph and queue