179 Commits

Author SHA1 Message Date
7cdda931fd Travis CI: Add pytest --doctest-modules graphs (#1018) 2019-07-17 06:07:25 +02:00
267b5eff40 Added doctest and more explanation about Dijkstra execution. (#1014)
* Added doctest and more explanation about Dijkstra execution.

* tests were not passing with python2 due to missing __init__.py file at number_theory folder

* Removed the dot at the beginning of the imported modules names because 'python3 -m doctest -v data_structures/hashing/*.py' and 'python3 -m doctest -v data_structures/stacks/*.py' were failing not finding hash_table.py and stack.py modules.

* Moved global code to main scope and added doctest for project euler problems 1 to 14.

* Added test case for negative input.

* Changed N variable to do not use end of line scape because in case there is a space after it the script will break making it much more error prone.

* Added problems description and doctests to the ones that were missing. Limited line length to 79 and executed python black over all scripts.

* Changed the way files are loaded to support pytest call.

* Added __init__.py to problems to make them modules and allow pytest execution.

* Added project_euler folder to test units execution

* Changed 'os.path.split(os.path.realpath(__file__))' to 'os.path.dirname()'
2019-07-17 01:09:53 +02:00
5f991f7740 #315 Renamed all files to snake_case (#993) 2019-07-11 11:16:42 +02:00
2ad5be9919 Modified Docstrings to Fix Errors (#975)
I modified the Docstrings at the beginning of the file to fix D400, W0105, and E402.
2019-07-10 22:00:30 +02:00
a212efee5b Corrected wrong Dijkstra priority queue implementation (#909)
* Corrected wrong DFS implementation

* changed list into hash set for dijkstra priority queue implementation.
2019-06-23 23:32:12 +08:00
a99acae32d Add docstring and comments per Issue #727 (#895)
I've added comments to make understanding this method a little easier for those that are not familiar.  This should close out #727 .

Other changes:
1. added if __name__ == '__main__' rather than the "# MAIN" comment
2. put in return for distances and vertices.  Previously everything was just printed out, but someone may find it useful to have the algorithm return something.
3. Other PEP8 changes
4.  Added example input and expected output as a check to make sure any future changes will give the same output.
2019-06-18 18:28:01 +08:00
55e0b0f00a Corrected wrong DFS implementation (#903) 2019-06-17 18:13:36 +08:00
ebe227c386 Removed Graphs and move prim.py to graphs (#872)
* Move prim.py from Graphs to graphs

* Removed prim.py from Graphs

* Update prim.py
2019-06-05 09:37:05 +08:00
Guo
f9b8dbf9db Correct the wrong iterative DFS implementation (#867)
* Update DFS.py

* Update DFS.py
2019-06-04 16:34:28 +08:00
71be23999c refactor 2019-05-26 21:56:10 +05:30
b5667e5ee9 Removed the (incorrectly named) redundant file graph_list.py and renamed graph.py to graph_list.py (#820) 2019-05-21 14:06:05 +08:00
f3608acfd5 Created shortest path using bfs (#794)
* Created shortest path using bfs
2019-05-17 11:12:06 +08:00
a65efd42c4 Implement check_bipartite_graph using DFS. (#808) 2019-05-16 19:24:56 +08:00
13c0c166d8 Update graph.py (#809) 2019-05-16 19:23:23 +08:00
e22ea7e380 Update Directed and Undirected (Weighted) Graph.py 2019-05-04 21:53:06 +05:30
df04d94543 Some directories had a capital in their name [fixed]. Added a recursive factorial algorithm. (#763)
* Renaming directories
* Adding a recursive factorial algorithm
2019-04-22 22:53:56 +08:00
9a44eb4479 Organize graph algorithms (#719)
* organized graph algorithms

* all graph algorithms in Graphs/ folder

* all graph algorithms are in one folder

* Rename number theory/factorial_python.py to maths/factorial_python.py
2019-02-25 17:35:24 +08:00
af08a67b20 added the dijkstra algorithm (#704) 2019-02-18 23:35:46 +08:00
c6be53e1c4 Rename Directed and Undirected (Weighted) Graph to Directed and Undirected (Weighted) Graph.py (#686) 2019-01-26 21:09:18 +08:00
069d2b9cb6 All Python Version 3
Added functions to get all nodes for some algorithms and time calculation for dfs and bfs.
2018-12-16 22:19:40 +03:30
b3a15175bd Added more functionality
Added topological sort, cycle detection and a function to report the nodes participating in cycles in graph(for a use case I myself needed ).
2018-12-14 23:14:35 +03:30
889f8fba3d Added getting node degree functionality to both directed and undirected graph
Easy to use directed and undirected graph in python 3
2018-12-14 15:28:45 +03:30
e97565d21f Added (Weighted) Undirected graph
Python version 3
2018-12-14 15:08:37 +03:30
687af17d47 Added some examples.
Added examples and comments for more readable code.
2018-12-14 10:31:45 +03:30
fa2eecdc30 Directed graph with optional weight assignment .
Containing graph auto-fill, dfs and bfs.
2018-12-14 10:22:18 +03:30
1a5df6bc46 Added the method to find the isolated nodes in the graph 2018-10-31 16:14:30 +05:30
ea2ddaaf6a all valid python 3 2018-10-20 14:45:08 -05:00
91fccecb56 snake_case all the things 2018-10-19 17:14:25 -05:00
564179a0ec increment 1 2018-10-19 07:48:28 -05:00