Hi,
testing your implementation with the sample graph, I noticed that with tway the query: q 1 6 returns a result not great. I expected the path 1->2->4->6, instead I obtained 1->3->5->6.
While, testing the same query with astar returns the expected result.