outputs graph correctly