First time here? Check out the FAQ!

Ask Your Question
0

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

asked 5 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

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
Preview: (hide)
link

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: 5 years ago

Seen: 318 times

Last updated: Oct 31 '19