Function ben::encode::relabel::relabel_ben_lines_with_map
source · pub fn relabel_ben_lines_with_map<R: Read, W: Write>(
reader: R,
writer: W,
new_to_old_node_map: HashMap<usize, usize>
) -> Result<()>Expand description
Relabels the values in a BEN file so that the assignment vector values are sorted according to a mapping. The mapping is a HashMap where the key is the position in the new assignment vector and the value is the position in the old assignment vector.
§Arguments
reader- A reader that implements theReadtrait containing the BEN file to be relabeled.writer- A writer that implements theWritetrait and which will contain the relabeled BEN file.new_to_old_node_map- A HashMap where the key is the position in the new assignment vector and the value is the position in the old assignment vector.
§Errors
Returns an error if the file format is invalid or if there is an issue reading or writing the file.