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

Method build

graphs/minimum_spanning_tree_boruvka.py:85–99  ·  view source on GitHub ↗

Builds a graph from the given set of vertices and edges

(vertices=None, edges=None)

Source from the content-addressed store, hash-verified

83
84 @staticmethod
85 def build(vertices=None, edges=None):
86 """
87 Builds a graph from the given set of vertices and edges
88
89 """
90 g = Graph()
91 if vertices is None:
92 vertices = []
93 if edges is None:
94 edge = []
95 for vertex in vertices:
96 g.add_vertex(vertex)
97 for edge in edges:
98 g.add_edge(*edge)
99 return g
100
101 class UnionFind:
102 """

Callers 1

boruvka_mstMethod · 0.45

Calls 3

add_vertexMethod · 0.95
add_edgeMethod · 0.95
GraphClass · 0.70

Tested by

no test coverage detected