Guest User

Untitled

a guest
Aug 16th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Timeit Python. How does it work?
  2. import maxcut as mc
  3. import networkx as nx
  4. G = nx.complete_graph(3)
  5.  
  6. mc.largest_eigenvector(G)
  7.  
  8. s = """
  9. import maxcut as mc
  10. import networkx as nx
  11. G = nx.complete_graph(3)
  12. """
  13. t = timeit.Timer(s, 'mc.largest_eigenvector(G)')
  14.  
  15. def tmp():
  16. import maxcut as mc
  17. import networkx as nx
  18. G = nx.complete_graph(3)
  19. mc.largest_eigenvector(G)
  20.  
  21. t = timeit.Timer(s, 'tmp()')
  22.  
  23. t = timeit.Timer(setup=s, stmt='mc.largest_eigenvector(G)')
Add Comment
Please, Sign In to add comment