graph constructor finished