Skip to content

Commit

Permalink
Scheduler: add output_graph_image method
Browse files Browse the repository at this point in the history
calls graph_scheduler.utilities.output_graph_image on self.graph
  • Loading branch information
kmantel committed Jun 26, 2024
1 parent 0d295cb commit 639b17d
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/graph_scheduler/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
)
from graph_scheduler.time import _get_pint_unit, Clock, TimeScale
from graph_scheduler.utilities import (
cached_graph_function, clone_graph, networkx_digraph_to_dependency_dict,
cached_graph_function, clone_graph, networkx_digraph_to_dependency_dict, output_graph_image,
typing_graph_dependency_dict,
)

Expand Down Expand Up @@ -1178,3 +1178,25 @@ def consideration_queue_indices(self) -> Dict[Hashable, int]:
"""
self._handle_modified_structural_conditions()
return self._consideration_queue_indices[-1]

def output_graph_image(self, filename: str = None, format: str = 'png'):
"""
See `graph_scheduler.utilities.output_graph_image`.
Writes an image representation of self.graph to file **filename**.
Args:
filename (str, optional): full path of image to write. Defaults
to 'graph-scheduler-figure-<graph id>.<format>' in the current
directory.
format (str, optional): image format. Many common formats
supported. Pass None to display supported formats. Defaults
to png unless specified by **filename** extension.
Returns:
name of file containing written image
Requires:
- system graphviz: https://graphviz.org/download
- Python pydot: pip install pydot
"""
return output_graph_image(self.graph, filename, format)

0 comments on commit 639b17d

Please sign in to comment.