Ask Your Question

how plot time complexity of program for different 'n' using sagemath?

asked 2019-10-30 23:59:18 -0500

anonymous user


I have written a code for graph coloring in sagemath. I'm finding difficult to plot a graph of running time of that program for different node (range of nodes is (1 to infinity or 100000)). Can anyone please tell me how?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2019-10-31 15:39:23 -0500

You can assemble the timing data using sage.misc.sage_timeit(visit for documentation):

sage: cmd = 'simplicial_complexes.PoincareHomologyThreeSphere().homology()'
sage: a = sage_timeit(cmd, globals())
sage: a # full timing data for the command
5 loops, best of 3: 16.8 ms per loop
sage: a.stats
(25, 3, 3, 16.850331239998013, 'ms')

sage: a = sage_timeit(cmd, globals(), seconds=True)
sage: a # time in seconds for the command
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-10-30 23:59:18 -0500

Seen: 58 times

Last updated: Oct 31 '19