Skip to content

Commit

Permalink
cleaned up code and added correct_outputs.txt for test graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
ntalluri committed Jan 23, 2024
1 parent 001dc5a commit dab0a3e
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 1 deletion.
53 changes: 53 additions & 0 deletions graphs/correct_outputs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
The graphs series of graphs are used to check the code's correctness. Except for internal tiebreaking by the solver, each result is deterministic.

graph1:
A B D
B D D

graph2:
A B D
B D D

graph3: deals with tiebreaking
A C D
C D D

graph4:
A B D
B D D

graph5:
A B U
B D U

graph6:
A B U
B D U

graph7: deals with tiebreaking
A B U
B D U

graph8:
A B U
B D U

graph9:
A B D
B D U

graph10:
A B D
B D D

graph11:
A B U
B D U

graph12:
A B D
B D D

graph13:
A B U
B D U
4 changes: 4 additions & 0 deletions graphs/graph12/edges.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A B 0.9 D
A C 0.1 D
B D 0.8 D
C D 0.2 D
1 change: 1 addition & 0 deletions graphs/graph12/sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A
1 change: 1 addition & 0 deletions graphs/graph12/targets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
D
4 changes: 4 additions & 0 deletions graphs/graph13/edges.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
A B 0.9 U
A C 0.1 U
B D 0.8 U
C D 0.2 U
1 change: 1 addition & 0 deletions graphs/graph13/sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A
1 change: 1 addition & 0 deletions graphs/graph13/targets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
D
2 changes: 1 addition & 1 deletion test_minCostFlow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


print("\ntesting code correctness")
for i in range (1,12):
for i in range (1,14):
print("graph: ",i)
args = [
"--edges_file", f"graphs/graph{i}/edges.txt",
Expand Down
31 changes: 31 additions & 0 deletions tests/correct_outputs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
The tests series of graphs are used to verify whether the code is executing appropriately depending on distinct edge cases.

test 1: check if unique directed edges are added to directed_dict
Output:
A B D
B C D

test2: check if higher edge weight is selected for the same directed edge from the input
Output:
A B D
B D D

test3: If a directed edge is present in the input and an undirected edge from that edge already exists, the directed edge is prioritized and added to directed_dict and the undirected edge is deleted from undirected_dict.
A C D
C D D

test4: check if unique undirected edges are added to undirected_dict
A B D
B D D

test5: check that an undirected edge is not added if a directed edge of that edge already exists
A B U
B D U

test6: check if higher edge weight is selected for the same undirected edge from the input
A B U
B D U

test7: check that code still runs and outputs an error message with an empty edges.txt
A B U
B D U

0 comments on commit dab0a3e

Please sign in to comment.