Skip to content

Instantly share code, notes, and snippets.

@craigarms
Last active January 15, 2024 16:26
Show Gist options
  • Save craigarms/4b0bc047c1bb4ea162728e08f3e28792 to your computer and use it in GitHub Desktop.
Save craigarms/4b0bc047c1bb4ea162728e08f3e28792 to your computer and use it in GitHub Desktop.
ChatGPT Corrected Sequence Diagram FInal
from graphviz import Digraph
# Create a Digraph from the DOT content
graph = Digraph(format='png')
graph.attr(dpi='300')
graph.attr(size='8,5')
graph.node_attr.update(color='lightblue2', style='filled')
graph.attr('node', shape='box', fontname="Arial", style='filled, rounded', fillcolor='#e2e2f0')
graph.node('b_start', label='Bob')
graph.node('b_0', label='', shape='point', height='0')
graph.node('b_1', label='', shape='point', height='0')
graph.node('b_2', label='', shape='point', height='0')
graph.node('b_3', label='', shape='point', height='0')
graph.node('b_end', label='Bob')
graph.edge('b_start', 'b_0', style='dashed', arrowhead='none')
graph.edge('b_0', 'b_1', style='dashed', arrowhead='none')
graph.edge('b_1', 'b_2', style='dashed', arrowhead='none')
graph.edge('b_2', 'b_3', style='dashed', arrowhead='none')
graph.edge('b_3', 'b_end', style='dashed', arrowhead='none')
graph.node('a_start', label='Alice')
graph.node('a_0', label='', shape='point', height='0')
graph.node('a_1', label='', shape='point', height='0')
graph.node('a_2', label='', shape='point', height='0')
graph.node('a_3', label='', shape='point', height='0')
graph.node('a_end', label='Alice')
graph.edge('a_start', 'a_0', style='dashed', arrowhead='none')
graph.edge('a_0', 'a_1', style='dashed', arrowhead='none')
graph.edge('a_1', 'a_2', style='dashed', arrowhead='none')
graph.edge('a_2', 'a_3', style='dashed', arrowhead='none')
graph.edge('a_3', 'a_end', style='dashed', arrowhead='none')
graph.node('c_start', label='Charlie')
graph.node('c_0', label='', shape='point', height='0')
graph.node('c_1', label='', shape='point', height='0')
graph.node('c_2', label='', shape='point', height='0')
graph.node('c_3', label='', shape='point', height='0')
graph.node('c_end', label='Charlie')
graph.edge('c_start', 'c_0', style='dashed', arrowhead='none')
graph.edge('c_0', 'c_1', style='dashed', arrowhead='none')
graph.edge('c_1', 'c_2', style='dashed', arrowhead='none')
graph.edge('c_2', 'c_3', style='dashed', arrowhead='none')
graph.edge('c_3', 'c_end', style='dashed', arrowhead='none')
c = Digraph()
c.attr(rank="same")
c.edge('b_0', 'a_0', weight='0', arrowhead='vee', fontname='Arial', label='<<B>1 </B>Authentication Request>')
graph.subgraph(c)
c = Digraph()
c.attr(rank="same")
c.edge('a_1', 'c_1', weight='0', arrowhead='vee', fontname='Arial', label='<<B>2 </B>Authentication Validation>')
graph.subgraph(c)
c = Digraph()
c.attr(rank="same")
c.edge('c_2', 'a_2', weight='0', arrowhead='vee', fontname='Arial', label='<<B>3 </B>Authentication Valid>')
graph.subgraph(c)
c = Digraph()
c.attr(rank="same")
c.edge('a_3', 'b_3', weight='0', arrowhead='vee', fontname='Arial', label='<<B>4 </B>Authentication Response>')
graph.subgraph(c)
# Save the graph as an image
graph.render('output_graph_3', format='png', cleanup=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment