Hi everybody, I need help with this code, I don´t understand this message…

If you can help me, I appreciate a lot…

this is the code on graph.py

from vertex import Vertex

class Graph:

def **init**(self):

```
self.graph_dict = {}
```

def add_vertex(self, node):

```
self.graph_dict[node.value] = node
```

def add_edge(self, from_node, to_node, weight = 0):

```
self.graph_dict[from_node.value].add_edge(to_node.value, weight)
self.graph_dict[to_node.value].add_edge(from_node.value, weight)
```

def explore(self):

```
print("Exploring the graph....\n")
#FILL IN EXPLORE METHOD BELOW
```

def print_map(self):

```
print("\nMAZE LAYOUT\n")
for node_key in self.graph_dict:
print("{0} connected to...".format(node_key))
node = self.graph_dict[node_key]
for adjacent_node, weight in node.edges.items():
print("=> {0}: cost is {1}".format(adjacent_node, weight))
print("")
print("")
```

def build_graph():

graph = Graph()

# MAKE ROOMS INTO VERTICES BELOW…

entrance = Vertex(“entrance”)

# ADD ROOMS TO GRAPH BELOW…

graph.add_vertex(entrance)

ante_chamber = Vertex(“ante-chamber”)

graph.add_vertex(ante_chamber)

kings_room = Vertex(“King’s room”)

graph.add_vertex(kings_room)

grand_gallery = Vertex(“grand gallery”)

treasure_room = Vertex(“treasure room”)

# ADD EDGES BETWEEN ROOMS BELOW…

graph.add_edge(entrance, ante_chamber, 7)

graph.add_edge(entrance, kings_room, 3)

graph.add_edge(kings_room, ante_chamber, 1)

graph.add_edge(grand_gallery, ante_chamber, 2)

graph.add_edge(grand_gallery, kings_room, 2)

graph.add_edge(treasure_room, ante_chamber, 6)

graph.add_edge(treasure_room, grand_gallery, 4)

# DON’T CHANGE THIS CODE

graph.print_map()

return graph

This is the message error:

Traceback (most recent call last):

excavation_site = build_graph()

File “/home/ccuser/workspace/maze-explorer/graph.py”, line 60 in build_graph

graph.add_edge(grand_gallery, ante_chamber, 2)

File “/home/ccuser/workspace/maze-explorer/graph.py”, line 11 , in add_edge

self.graph_dict[from_node.value].add_edge(to_node.value, weight)

keyError: ‘grand gallery’