Module utils

Source
Expand description

This module provides some utility functions for working with assignments and RLE encoding. It also provides a function to sort a JSON file by a key so as to make the BEN encoding more efficient.

Functionsยง

assign_to_rle
Convert a vector of assignments to a run-length encoded (RLE) vector.
rle_to_vec
Convert a run-length encoded (RLE) vector to a vector of assignments.
sort_json_file_by_key
Sorts a JSON-formatted NetworkX graph file by a key. This function will sort the nodes in the graph by the key provided and then relabel the nodes in the graph from 0 to n-1 where n is the number of nodes in the graph. It will also relabel the edges in the graph to match the new node labels.