Skip to content

Commit d23fcba

Browse files
committed
'Updated'
2 parents e467d5c + 1508210 commit d23fcba

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Installation
3131
pip3 install pygorithm
3232

3333
- | It's that easy. If you are using Python 2.7 use pip instead. Depending on your
34-
| permissions, you might need to ``sudo`` before installing
34+
| permissions, you might need to use ``pip install --user pygorithm`` to install.
3535
3636

3737
Quick Start Guide

pygorithm/searching/breadth_first_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Created On: 1st August 2017
33

44
# breadth first search algorithm
5-
def bfs(graph, startVertex):
5+
def search(graph, startVertex):
66
# Take a list for stoting already visited vertexes
77
if startVertex not in graph or graph[startVertex] is None or graph[startVertex] == []:
88
return None
@@ -25,4 +25,4 @@ def time_complexities():
2525
# easily retrieve the source code of the bfs function
2626
def get_code():
2727
import inspect
28-
return inspect.getsource(bfs)
28+
return inspect.getsource(search)

pygorithm/searching/depth_first_search.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Created On: 1st August 2017
33

44
# depth first search algorithm
5-
def dfs(graph, start, path = []):
5+
def search(graph, start, path = []):
66
# check if graph is empty or start vertex is none
77
if start not in graph or graph[start] is None or graph[start] == []:
88
return None
@@ -19,4 +19,4 @@ def time_complexities():
1919
# easily retrieve the source code of the dfs function
2020
def get_code():
2121
import inspect
22-
return inspect.getsource(dfs)
22+
return inspect.getsource(search)

tests/searching_tests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ def test_bfs(self):
4747
'E': {'A'},
4848
'G': {'C'}
4949
}
50-
result = breadth_first_search.bfs(self.graph, 'A')
50+
result = breadth_first_search.search(self.graph, 'A')
5151
self.assertEqual(result, {'A', 'B', 'D', 'F', 'C', 'G', 'E'})
52-
result = breadth_first_search.bfs(self.graph, 'G')
52+
result = breadth_first_search.search(self.graph, 'G')
5353
self.assertEqual(result, {'G', 'C', 'A', 'B', 'D', 'F', 'E'})
5454

5555
class DFSSearch(unittest.TestCase):
@@ -63,9 +63,9 @@ def test_dfs(self):
6363
'E': ['A'],
6464
'G': ['C']
6565
}
66-
result = depth_first_search.dfs(self.graph, 'A')
66+
result = depth_first_search.search(self.graph, 'A')
6767
self.assertEqual(result, ['A', 'B', 'D', 'F', 'C', 'G', 'E'])
68-
result = depth_first_search.dfs(self.graph, 'G')
68+
result = depth_first_search.search(self.graph, 'G')
6969
self.assertEqual(result, ['G', 'C', 'A', 'B', 'D', 'F', 'E'])
7070

7171
if __name__ == '__main__':

0 commit comments

Comments
 (0)