Skip to content

Commit bc73e51

Browse files
committed
Added docs
1 parent 7b8b860 commit bc73e51

File tree

18 files changed

+317
-35
lines changed

18 files changed

+317
-35
lines changed

pydatastructs/graphs/algorithms.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def breadth_first_search(
5151
current node and the node next to current node.
5252
The rest of the arguments are optional and you can
5353
provide your own stuff there.
54+
backend: pydatastructs.Backend
55+
The backend to be used.
56+
Optional, by default, the best available
57+
backend is used.
5458
5559
Note
5660
====
@@ -135,6 +139,10 @@ def breadth_first_search_parallel(
135139
current node and the node next to current node.
136140
The rest of the arguments are optional and you can
137141
provide your own stuff there.
142+
backend: pydatastructs.Backend
143+
The backend to be used.
144+
Optional, by default, the best available
145+
backend is used.
138146
139147
Note
140148
====
@@ -280,6 +288,10 @@ def minimum_spanning_tree(graph, algorithm, **kwargs):
280288
'kruskal' -> Kruskal's algorithm as given in [1].
281289
282290
'prim' -> Prim's algorithm as given in [2].
291+
backend: pydatastructs.Backend
292+
The backend to be used.
293+
Optional, by default, the best available
294+
backend is used.
283295
284296
Returns
285297
=======
@@ -418,6 +430,10 @@ def minimum_spanning_tree_parallel(graph, algorithm, num_threads, **kwargs):
418430
'prim' -> Prim's algorithm as given in [2].
419431
num_threads: int
420432
The number of threads to be used.
433+
backend: pydatastructs.Backend
434+
The backend to be used.
435+
Optional, by default, the best available
436+
backend is used.
421437
422438
Returns
423439
=======
@@ -531,6 +547,10 @@ def strongly_connected_components(graph, algorithm, **kwargs):
531547
supported,
532548
533549
'kosaraju' -> Kosaraju's algorithm as given in [1].
550+
backend: pydatastructs.Backend
551+
The backend to be used.
552+
Optional, by default, the best available
553+
backend is used.
534554
535555
Returns
536556
=======
@@ -593,6 +613,10 @@ def depth_first_search(
593613
current node and the node next to current node.
594614
The rest of the arguments are optional and you can
595615
provide your own stuff there.
616+
backend: pydatastructs.Backend
617+
The backend to be used.
618+
Optional, by default, the best available
619+
backend is used.
596620
597621
Note
598622
====
@@ -681,6 +705,10 @@ def shortest_paths(graph: Graph, algorithm: str,
681705
The name of the target node.
682706
Optional, by default, all pair shortest paths
683707
are returned.
708+
backend: pydatastructs.Backend
709+
The backend to be used.
710+
Optional, by default, the best available
711+
backend is used.
684712
685713
Returns
686714
=======
@@ -797,6 +825,10 @@ def all_pair_shortest_paths(graph: Graph, algorithm: str,
797825
are implemented,
798826
799827
'floyd_warshall' -> Floyd Warshall algorithm as given in [1].
828+
backend: pydatastructs.Backend
829+
The backend to be used.
830+
Optional, by default, the best available
831+
backend is used.
800832
801833
Returns
802834
=======
@@ -882,6 +914,10 @@ def topological_sort(graph: Graph, algorithm: str,
882914
Currently, following are supported,
883915
884916
'kahn' -> Kahn's algorithm as given in [1].
917+
backend: pydatastructs.Backend
918+
The backend to be used.
919+
Optional, by default, the best available
920+
backend is used.
885921
886922
Returns
887923
=======
@@ -959,6 +995,10 @@ def topological_sort_parallel(graph: Graph, algorithm: str, num_threads: int,
959995
'kahn' -> Kahn's algorithm as given in [1].
960996
num_threads: int
961997
The maximum number of threads to be used.
998+
backend: pydatastructs.Backend
999+
The backend to be used.
1000+
Optional, by default, the best available
1001+
backend is used.
9621002
9631003
Returns
9641004
=======

pydatastructs/graphs/graph.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class Graph(object):
2626
vertices: GraphNode(s)
2727
For AdjacencyList implementation vertices
2828
can be passed for initializing the graph.
29+
backend: pydatastructs.Backend
30+
The backend to be used.
31+
Optional, by default, the best available
32+
backend is used.
2933
3034
Examples
3135
========

pydatastructs/linear_data_structures/algorithms.py

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ def merge_sort_parallel(array, num_threads, **kwargs):
8383
Optional, by default, less than or
8484
equal to is used for comparing two
8585
values.
86+
backend: pydatastructs.Backend
87+
The backend to be used.
88+
Optional, by default, the best available
89+
backend is used.
8690
8791
Examples
8892
========
@@ -147,6 +151,10 @@ def brick_sort(array, **kwargs):
147151
Optional, by default, less than or
148152
equal to is used for comparing two
149153
values.
154+
backend: pydatastructs.Backend
155+
The backend to be used.
156+
Optional, by default, the best available
157+
backend is used.
150158
151159
Examples
152160
========
@@ -217,6 +225,10 @@ def brick_sort_parallel(array, num_threads, **kwargs):
217225
Optional, by default, less than or
218226
equal to is used for comparing two
219227
values.
228+
backend: pydatastructs.Backend
229+
The backend to be used.
230+
Optional, by default, the best available
231+
backend is used.
220232
221233
Examples
222234
========
@@ -272,6 +284,10 @@ def heapsort(array, **kwargs):
272284
is to be sorted.
273285
Optional, by default the index
274286
of the last position filled.
287+
backend: pydatastructs.Backend
288+
The backend to be used.
289+
Optional, by default, the best available
290+
backend is used.
275291
276292
Examples
277293
========
@@ -323,6 +339,10 @@ def counting_sort(array: Array, **kwargs) -> Array:
323339
324340
array: Array
325341
The array which is to be sorted.
342+
backend: pydatastructs.Backend
343+
The backend to be used.
344+
Optional, by default, the best available
345+
backend is used.
326346
327347
Returns
328348
=======
@@ -408,13 +428,15 @@ def matrix_multiply_parallel(matrix_1, matrix_2, num_threads):
408428
409429
matrix_1: Any matrix representation
410430
Left matrix
411-
412431
matrix_2: Any matrix representation
413432
Right matrix
414-
415433
num_threads: int
416434
The maximum number of threads
417435
to be used for multiplication.
436+
backend: pydatastructs.Backend
437+
The backend to be used.
438+
Optional, by default, the best available
439+
backend is used.
418440
419441
Raises
420442
======
@@ -488,6 +510,10 @@ def bucket_sort(array: Array, **kwargs) -> Array:
488510
is to be sorted.
489511
Optional, by default the index
490512
of the last position filled.
513+
backend: pydatastructs.Backend
514+
The backend to be used.
515+
Optional, by default, the best available
516+
backend is used.
491517
492518
Returns
493519
=======
@@ -593,6 +619,10 @@ def cocktail_shaker_sort(array: Array, **kwargs) -> Array:
593619
Optional, by default, less than or
594620
equal to is used for comparing two
595621
values.
622+
backend: pydatastructs.Backend
623+
The backend to be used.
624+
Optional, by default, the best available
625+
backend is used.
596626
597627
Returns
598628
=======
@@ -682,6 +712,10 @@ def quick_sort(array: Array, **kwargs) -> Array:
682712
the original input array to `quick_sort` function.
683713
Optional, by default, picks the element at `high`
684714
index of the current partition as pivot.
715+
backend: pydatastructs.Backend
716+
The backend to be used.
717+
Optional, by default, the best available
718+
backend is used.
685719
686720
Returns
687721
=======
@@ -760,6 +794,10 @@ def longest_common_subsequence(seq1: OneDimensionalArray, seq2: OneDimensionalAr
760794
The first sequence.
761795
seq2: OneDimensionalArray
762796
The second sequence.
797+
backend: pydatastructs.Backend
798+
The backend to be used.
799+
Optional, by default, the best available
800+
backend is used.
763801
764802
Returns
765803
=======
@@ -839,6 +877,10 @@ def is_ordered(array, **kwargs):
839877
Optional, by default, less than or
840878
equal to is used for comparing two
841879
values.
880+
backend: pydatastructs.Backend
881+
The backend to be used.
882+
Optional, by default, the best available
883+
backend is used.
842884
843885
Returns
844886
=======
@@ -895,6 +937,10 @@ def upper_bound(array, value, **kwargs):
895937
Optional, by default, less than or
896938
equal to is used for comparing two
897939
values.
940+
backend: pydatastructs.Backend
941+
The backend to be used.
942+
Optional, by default, the best available
943+
backend is used.
898944
899945
Returns
900946
=======
@@ -964,6 +1010,10 @@ def lower_bound(array, value, **kwargs):
9641010
Optional, by default, less than or
9651011
equal to is used for comparing two
9661012
values.
1013+
backend: pydatastructs.Backend
1014+
The backend to be used.
1015+
Optional, by default, the best available
1016+
backend is used.
9671017
9681018
Returns
9691019
=======
@@ -1020,6 +1070,10 @@ def longest_increasing_subsequence(array, **kwargs):
10201070
10211071
array: OneDimensionalArray
10221072
The given array in the form of a OneDimensionalArray
1073+
backend: pydatastructs.Backend
1074+
The backend to be used.
1075+
Optional, by default, the best available
1076+
backend is used.
10231077
10241078
Returns
10251079
=======
@@ -1124,6 +1178,10 @@ def next_permutation(array, **kwargs):
11241178
desired lexicographical ordering.
11251179
Optional, by default, less than is
11261180
used for comparing two values.
1181+
backend: pydatastructs.Backend
1182+
The backend to be used.
1183+
Optional, by default, the best available
1184+
backend is used.
11271185
11281186
11291187
Returns
@@ -1193,6 +1251,10 @@ def prev_permutation(array, **kwargs):
11931251
desired lexicographical ordering.
11941252
Optional, by default, less than is
11951253
used for comparing two values.
1254+
backend: pydatastructs.Backend
1255+
The backend to be used.
1256+
Optional, by default, the best available
1257+
backend is used.
11961258
11971259
11981260
Returns

pydatastructs/linear_data_structures/arrays.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ class OneDimensionalArray(Array):
3434
The inital value with which the element has
3535
to be initialized. By default none, used only
3636
when the data is not given.
37+
backend: pydatastructs.Backend
38+
The backend to be used.
39+
Optional, by default, the best available
40+
backend is used.
3741
3842
Raises
3943
======
@@ -156,6 +160,10 @@ class MultiDimensionalArray(Array):
156160
A valid object type.
157161
*args: int
158162
The dimensions of the array.
163+
backend: pydatastructs.Backend
164+
The backend to be used.
165+
Optional, by default, the best available
166+
backend is used.
159167
160168
Raises
161169
======
@@ -297,6 +305,10 @@ class DynamicOneDimensionalArray(DynamicArray, OneDimensionalArray):
297305
The number below which if the ratio, Num(T)/Size(T)
298306
falls then the array is contracted such that at
299307
most only half the positions are filled.
308+
backend: pydatastructs.Backend
309+
The backend to be used.
310+
Optional, by default, the best available
311+
backend is used.
300312
301313
Raises
302314
======
@@ -421,6 +433,14 @@ class ArrayForTrees(DynamicOneDimensionalArray):
421433
"""
422434
Utility dynamic array for storing nodes of a tree.
423435
436+
Parameters
437+
==========
438+
439+
backend: pydatastructs.Backend
440+
The backend to be used.
441+
Optional, by default, the best available
442+
backend is used.
443+
424444
See Also
425445
========
426446

0 commit comments

Comments
 (0)