Last active
January 2, 2021 17:08
-
-
Save xalelax/c9755404b1067cd0bd947dffd47ec536 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import defaultdict | |
| def decompose_edges_by_len(hypergraph): | |
| decomposed_edges = defaultdict(list) | |
| for edge in hypergraph['edges']: | |
| decomposed_edges[len(edge)].append(edge) | |
| decomposition = { | |
| 'nodes': hypergraph['nodes'], | |
| 'edges': decomposed_edges | |
| } | |
| return decomposition |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment