Ask Your Question
0

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

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

anonymous user

Anonymous

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
1

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

You can assemble the timing data using sage.misc.sage_timeit(visit http://doc.sagemath.org/html/en/refer... 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
0.016884897239999645
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

Stats

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

Seen: 25 times

Last updated: Oct 31