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

Function construct_graph

graphs/frequent_pattern_graph_miner.py:154–169  ·  view source on GitHub ↗
(cluster, nodes)

Source from the content-addressed store, hash-verified

152
153
154def construct_graph(cluster, nodes):
155 x = cluster[max(cluster.keys())]
156 cluster[max(cluster.keys()) + 1] = "Header"
157 graph = {}
158 for i in x:
159 if (["Header"],) in graph:
160 graph[(["Header"],)].append(x[i])
161 else:
162 graph[(["Header"],)] = [x[i]]
163 for i in x:
164 graph[(x[i],)] = [["Header"]]
165 i = 1
166 while i < max(cluster) - 1:
167 create_edge(nodes, graph, cluster, i)
168 i = i + 1
169 return graph
170
171
172def my_dfs(graph, start, end, path=None):

Callers 1

Calls 3

create_edgeFunction · 0.85
keysMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected