Advertisement
D0tty

Untitled

Apr 19th, 2021
1,454
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.49 KB | None | 0 0
  1. #! python3
  2.  
  3. import networkx as nx
  4.  
  5. g = nx.DiGraph()
  6. g_sec = nx.DiGraph()
  7. r = set(['protocolMessage', 'CancelArguments', 'InitReqArguments', 'AttachRequestArguments'])
  8.  
  9. # first graph
  10. g.add_edge('protocolMessage', 'request')
  11. g.add_edge('protocolMessage', 'event')
  12. g.add_edge('protocolMessage', 'response')
  13.  
  14. g.add_edge('request', 'CancelRequest')
  15. g.add_edge('request', 'RunInTermRequest')
  16. g.add_edge('request', 'AttachRequest')
  17. g.add_edge('AttachRequestArguments', 'AttachRequest')
  18.  
  19. g.add_edge('event', 'InitEvent')
  20. g.add_edge('event', 'StopEvent')
  21.  
  22.  
  23. g.add_edge('response', 'ErrorResponse')
  24. g.add_edge('response', 'CancelResponse')
  25.  
  26.  
  27. # second graph
  28. g_sec.add_edge('request' , 'protocolMessage' )
  29. g_sec.add_edge('event'   , 'protocolMessage' )
  30. g_sec.add_edge('response', 'protocolMessage' )
  31.  
  32. g_sec.add_edge( 'CancelRequest'  , 'request'                 )
  33. g_sec.add_edge( 'RunInTermRequest','request'                 )
  34. g_sec.add_edge( 'AttachRequest',   'request'                 )
  35. g_sec.add_edge( 'AttachRequest',   'AttachRequestArguments'  )
  36.  
  37. g_sec.add_edge('InitEvent','event')
  38. g_sec.add_edge('StopEvent','event')
  39.  
  40.  
  41. g_sec.add_edge('ErrorResponse', 'response')
  42. g_sec.add_edge('CancelResponse','response')
  43.  
  44. # L.append((list(nx.dfs_edges(g, s))))
  45.  
  46. # So after some investigation I come to several epiphanies:
  47. # first: I need to use the second way of using the graph
  48. # second: It's 2:30AM
  49. # third: It's no time to work but to sleep
  50. # forth: I really need to consult a psychologist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement