DiagramWriter#
- class DiagramWriter(filename, notation='native', comment=None)#
Bases:
_BaseDiagramWriter
A file writer for knot diagrams. - Writes one diagram at a time per line, using a given notation. - Supports adding an optional comment at the start of the file.
- __init__(filename, notation='native', comment=None)#
Initializes the writer.
- Parameters:
filename – Path to the output file.
notation – The diagram notation (‘dowker’, ‘gauss’, etc.).
comment – (Optional) A comment to add at the start of the file.
Methods
__init__
(filename[, notation, comment])Initializes the writer.
close
()Closes the file.
write_comment
(comment)write_diagram
(diagram)Converts and writes a single diagram to the file.
write_diagrams
(diagrams)Converts and writes a single diagram to the file.
- close()#
Closes the file.
- write_diagram(diagram)#
Converts and writes a single diagram to the file. :param diagram: The diagram object.
- write_diagrams(diagrams)#
Converts and writes a single diagram to the file. :param diagrams: A list of diagram object.