(args)
| 165 | |
| 166 | |
| 167 | def read_hsgr_file(args): |
| 168 | with tarfile.open(args.input + ".hsgr", "r") as tar: |
| 169 | found = 0 |
| 170 | root = f"/ch/metrics/{args.metric}/contracted_graph/" |
| 171 | for member in tar: |
| 172 | if fnmatch.fnmatch(member.name, root + "node_array"): |
| 173 | node_buffer = tar.extractfile(member).read() |
| 174 | found += 1 |
| 175 | if fnmatch.fnmatch(member.name, root + "edge_array"): |
| 176 | edge_buffer = tar.extractfile(member).read() |
| 177 | found += 1 |
| 178 | if found != 2: |
| 179 | raise Exception(f"member {root} not found") |
| 180 | nodes = struct.iter_unpack("<L", node_buffer) |
| 181 | nodes2 = struct.iter_unpack("<L", node_buffer) |
| 182 | return nodes, expand_nodes(nodes2, HsgrEdge.make(edge_buffer)) |
| 183 | |
| 184 | |
| 185 | def join(params): |
no test coverage detected