Skip to content

DFS implemented (using the BFS API) #253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 9, 2020

Conversation

HarsheetKakar
Copy link
Contributor

References to other Issues or PRs or Relevant literature

Fixes #111

Brief description of what is fixed or changed

Other comments

@codecov
Copy link

codecov bot commented Apr 8, 2020

Codecov Report

Merging #253 into master will increase coverage by 0.016%.
The diff coverage is 100.000%.

@@              Coverage Diff              @@
##            master      #253       +/-   ##
=============================================
+ Coverage   98.546%   98.563%   +0.016%     
=============================================
  Files           24        24               
  Lines         2202      2228       +26     
=============================================
+ Hits          2170      2196       +26     
  Misses          32        32               
Impacted Files Coverage Δ
pydatastructs/graphs/__init__.py 100.000% <ø> (ø)
pydatastructs/graphs/algorithms.py 100.000% <100.000%> (ø)

Impacted file tree graph

@HarsheetKakar
Copy link
Contributor Author

sir is there any benefit of using .get method instead of simply checking the key

@czgdp1807
Copy link
Member

In fact, in is better at least for numbers.

>>> d = {k: v for k, v in zip(range(10**7), range(10**7))}
>>> import timeit
>>> def f():
...     return 10**6 in d
... 
>>> def g():
...     return d.get(10**6, None)
... 
>>> timeit.timeit(f)
0.09641253299923846
>>> timeit.timeit(g)
0.14119643199956045

@HarsheetKakar
Copy link
Contributor Author

In fact, in is better at least for numbers.

>>> d = {k: v for k, v in zip(range(10**7), range(10**7))}
>>> import timeit
>>> def f():
...     return 10**6 in d
... 
>>> def g():
...     return d.get(10**6, None)
... 
>>> timeit.timeit(f)
0.09641253299923846
>>> timeit.timeit(g)
0.14119643199956045

thats a good chunk of time saved, never thought it would have that.

@czgdp1807
Copy link
Member

Merging.

@czgdp1807 czgdp1807 merged commit 4452dc8 into codezonediitj:master Apr 9, 2020
@HarsheetKakar HarsheetKakar deleted the dfs branch April 9, 2020 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add depth first search for graphs
3 participants