Untitled
import matplotlib.pyplot as plt from graphviz import Digraph # Create a directed graph flow_chart = Digraph(format='png', graph_attr={'rankdir': 'LR', 'size': '8,5'}) # Add nodes flow_chart.node("Start", "Start", shape="ellipse") flow_chart.node("Borrowing", "Borrowing Process", shape="box") flow_chart.node("Renewal", "Renewal Process", shape="box") flow_chart.node("Cataloging", "Record Keeping & Cataloging", shape="box") flow_chart.node("Returning", "Returning Process", shape="box") flow_chart.node("End", "End", shape="ellipse") # Add edges flow_chart.edge("Start", "Borrowing") flow_chart.edge("Borrowing", "Renewal", label="If Renewal Requested", constraint="true") flow_chart.edge("Borrowing", "Returning", label="If Returning", constraint="true") flow_chart.edge("Renewal", "Returning", label="After Renewal Period", constraint="true") flow_chart.edge("Returning", "Cataloging") flow_chart.edge("Cataloging", "End") # Render the flow chart and display file_path = "/mnt/data/Library_Process_Flow.png" flow_chart.render(file_path, cleanup=True) file_path
Leave a Comment