MCPcopy Index your code
hub / github.com/TheAlgorithms/Python / add_vertex

Method add_vertex

graphs/minimum_spanning_tree_boruvka.py:11–18  ·  view source on GitHub ↗

Adds a vertex to the graph

(self, vertex)

Source from the content-addressed store, hash-verified

9 self.adjacency = {}
10
11 def add_vertex(self, vertex):
12 """
13 Adds a vertex to the graph
14
15 """
16 if vertex not in self.adjacency:
17 self.adjacency[vertex] = {}
18 self.num_vertices += 1
19
20 def add_edge(self, head, tail, weight):
21 """

Callers 2

add_edgeMethod · 0.95
buildMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected