Graph Problem

    I’m really struggling with this graph problem because the hard part is how to model the maze as a graph.

    Please help me solve it in C++ or Python preferably with a known graph algorithm, the expected input and output of this graph problem will be explained below:

    One of the attached images explains the graph problem and reads:

    Our story so far: In Maze 7, Dastardly Dan had tried to sabotage Jumping Jim’s act by restringing all his trampolines. But Dan’s actions had the opposite effect. The audience was so delighted by Jim’s leaping about trying to reach the goal, that his act became the most popular of the circus. The circus owner decided to commission Dastardly Dan to create another, even harder maze for Jim to solve. Dan added more trampolines, restrung them, and painted large numbers on each to indicate how far Jim will move when he bounces off each trampoline. The painted numbers would allow the audience to study the maze and try to find a solution before Jim did. Dan also added a new rule that Jim had to follow. Certain of the numbers were painted in red and enclosed in circles. When Jim begins his act, he can move only vertically or horizontally through the maze of trampolines; he cannot move diagonally. However, if he lands on a red number in a circle, he must then start moving only diagonally, now he can’t move vertically or horizontally. Jim must continue moving diagonally until he again lands on a red number. He then switches back to moving only vertically or horizontally. And he switches each time he lands on a red number. Here’s an example to show how that works. Jim begins on the 4 at the northwest comer of the maze. From there he might move south four squares to the red 3. Now he must start moving diagonally. He might go three squares northeast to a 4. On the next move he would continue moving diagonally. He could move four squares southeast to a red I (i). That red number would cause him to switch back to moving only horizontally or vertically. Can you find a route that would let Jim land on the trampoline marked GOAL?

    Please complete what the upload images request for the input and output of the program.

                                                                                                                                      Order Now