MCPcopy Index your code
hub / github.com/subbarayudu-j/TheAlgorithms-Python / addEdge

Method addEdge

Graphs/depth_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 DFS(self):
28 # visited array for storing already visited nodes

Callers 1

Calls 1

keysMethod · 0.80

Tested by

no test coverage detected