initial graph theory code