hatvis.io.parse_hypergodot#

hatvis.io.parse_hypergodot(text, name=None)[source]#

Parse the HyperGodot text format.

Every non-empty line is a hyperedge: vertex labels separated by spaces, followed by optional tags such as #WEIGHT: 12 and #GROUP: 2023 (the colon is optional). #WEIGHT becomes the hyperedge weight, every other tag a column of edge_data (lower-case name).

>>> H = parse_hypergodot("v1 v2 v3 #WEIGHT: 12 #GROUP: 2023\nv4 v5 #WEIGHT: 8 #GROUP: 2022")
>>> H.weights.tolist(), H.edge_data["group"].tolist()
([12.0, 8.0], ['2023', '2022'])