The SketchSequence Class

class pdsketch.SketchSequence(diagram: Optional[pdsketch.diagram.Diagram] = None, n: Optional[int] = None)

A class to generate sketches from a persistence diagram.

Parameters
  • diagram (Diagram) – The PD to be sketched

  • n (int) – The number of sketches to be produced

load_from_file()

Loads a sketch sequence from a text file. File format: b_i d_i; parent_i; transportplan_i where (b_i, d_i) is the ith point added to the sketch, parent_i is its parent and transportplan_i is the ith transportation plan in defaultdict(int) format.

save_to_file(filename: str = 'sketch.dgm')

Save current sketches to a text file. The ith line will be saved as follows: b_i d_i; mass_i; parent_i; updateplan_i where (b_i, d_i) is the ith point added to the sketch, parent_i is the index of its parent and updateplan_i is the ith transportation plan as a dictionary.

sketch_bottleneck(i: int) float

Returns the bottleneck distance between the original diagram and its ith sketch