I am trying to solve the 8 puzzle using `A*` Search for an assignment. I will be given an initial state and a goal state that I have to use to reach using the `A*` algorithm to reach the optimal path. My approach is to take the initial state as a list, then generate its successor states that can be generated based on the ways I can move the blank square(represented by 0). Then for each of the successor states I can calculate the heuristic, the Manhattan distance which I can use as the priority for a priority queue.

For example, if my initial state is `[1,2,3,0,4,5,6,7,8]: 0` , the child states would be `[0,2,3,1,4,5,6,7,8]: x`, `[1,2,3,4,0,6,7,8] : x` and `[1,2,3,6,4,5,0,7,8]: x`. I don't know how to represent this as a graph, choose the lowest priority state and then expand that.

I am not sure where to go from here. How do I add the parent state and successor to a graph so I can do `A*`?