MCPcopy Create free account
hub / github.com/subbarayudu-j/TheAlgorithms-Python / addEdge

Method addEdge

Graphs/breadth_first_search.py:19–25  ·  view source on GitHub ↗
(self, fromVertex, toVertex)

Source from the content-addressed store, hash-verified

17
18 # for adding the edge beween two vertexes
19 def addEdge(self, fromVertex, toVertex):
20 # check if vertex is already present,
21 if fromVertex in self.vertex.keys():
22 self.vertex[fromVertex].append(toVertex)
23 else:
24 # else make a new vertex
25 self.vertex[fromVertex] = [toVertex]
26
27 def BFS(self, startVertex):
28 # Take a list for stoting already visited vertexes

Callers 1

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected