MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / connect

Function connect

graphs/prim.py:47–53  ·  view source on GitHub ↗
(graph, a, b, edge)

Source from the content-addressed store, hash-verified

45
46
47def connect(graph, a, b, edge):
48 # add the neighbors:
49 graph[a - 1].add_neighbor(graph[b - 1])
50 graph[b - 1].add_neighbor(graph[a - 1])
51 # add the edges:
52 graph[a - 1].add_edge(graph[b - 1], edge)
53 graph[b - 1].add_edge(graph[a - 1], edge)
54
55
56def prim(graph: list, root: Vertex) -> list:

Callers

nothing calls this directly

Calls 2

add_neighborMethod · 0.80
add_edgeMethod · 0.45

Tested by

no test coverage detected