Fixed findEdge(), was returning an iterator to a local variable which was causing dangling pointer. Fixed formatting in main()