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

Function get_nodes

graphs/frequent_pattern_graph_miner.py:74–85  ·  view source on GitHub ↗

Returns nodes format nodes={bitcode:edges that represent the bitcode} >>> get_nodes([['ab', 5, '11111'], ['ac', 5, '11111'], ['df', 5, '11111'], ... ['bd', 5, '11111'], ['bc', 5, '11111']]) {'11111': ['ab', 'ac', 'df', 'bd', 'bc']}

(frequency_table)

Source from the content-addressed store, hash-verified

72
73
74def get_nodes(frequency_table):
75 """
76 Returns nodes
77 format nodes={bitcode:edges that represent the bitcode}
78 >>> get_nodes([['ab', 5, '11111'], ['ac', 5, '11111'], ['df', 5, '11111'],
79 ... ['bd', 5, '11111'], ['bc', 5, '11111']])
80 {'11111': ['ab', 'ac', 'df', 'bd', 'bc']}
81 """
82 nodes = {}
83 for _, item in enumerate(frequency_table):
84 nodes.setdefault(item[2], []).append(item[0])
85 return nodes
86
87
88def get_cluster(nodes):

Callers 1

Calls 1

appendMethod · 0.45

Tested by

no test coverage detected