Commit Graph

5 Commits

Author SHA1 Message Date
Rohan R Bharadwaj
ed4c92d98a
[mypy] Type annotations for graphs directory (#5798)
* Type annotations for `breadth_first_search.py`

* Type annotations for `breadth_first_search_2.py`

* Remove from excluded in mypy.ini

* Add doctest.testmod()

* Type annotations for `graphs/check_cycle.py`

* Type annotations for `graphs/greedy_min_vertex_cover.py`

* Remove from excluded in mypy.ini
2021-11-08 19:18:30 +01:00
Casper Rysgaard
e6cf13cc03
Update queue implementation (#5388)
* Update queue implementation

Popping the first element of a list takes O(n) time.
Using a cyclic queue takes O(1) time.

* Add queue changes from extra files

* Update indentation

* Add empty line between imports

* Fix lines

* Apply suggestions from code review

Co-authored-by: John Law <johnlaw.po@gmail.com>

Co-authored-by: John Law <johnlaw.po@gmail.com>
2021-10-30 19:06:25 +08:00
Christian Clauss
9200a2e543
from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Christian Clauss
5f4da5d616
isort --profile black . (#2181)
* updating DIRECTORY.md

* isort --profile black .

* Black after

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-07-06 09:44:19 +02:00
wuyudi
d2fa91b18e
Add url and typing hint for BFS (#2156)
* Add typing for bfs

* Add url for BFS

* rename the function

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update graphs/bfs.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Change the return value type of bfs

* change the function name.

change all instances of bfs() to breadth_first_search().

* change the function name in annotate

* Add one more blank line.

* Delete one blank line.

* Delete one blank line.

I've read the https://www.flake8rules.com/rules/W391.html, and still don't know how to do it. I've tried using 0 ,1,2 blank lines...

* Update graphs/bfs.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Update graphs/bfs.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* Rename bfs.py to breadth_first_search_2.py

Co-authored-by: Christian Clauss <cclauss@me.com>
2020-06-25 17:54:41 +02:00