forked from keon/algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Hardik dadhich
committed
Mar 7, 2020
1 parent
4ecdba1
commit c117e19
Showing
3 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import unittest | ||
from algorithms.graph import count_connected_number_of_component | ||
|
||
class TestConnectedComponentInGraph(unittest.TestCase): | ||
""" Class """ | ||
|
||
def test_count_connected_components(self): | ||
""" | ||
Test Function that test the different cases of count connected components | ||
0----------2 1--------5 3 | ||
| | ||
| | ||
4 | ||
output = 3 | ||
""" | ||
expected_result = 3 | ||
l = [[2], | ||
[5], | ||
[0,4], | ||
[], | ||
[2], | ||
[1] | ||
] | ||
|
||
size = 5 | ||
result = count_connected_number_of_component.count_components(l,size) | ||
self.assertEqual(result,expected_result) | ||
|
||
if __name__ == '__main__': | ||
|
||
unittest.main() | ||
|
||
|
||
|