update code to construct graph from schedule