Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 10, 2024
1 parent d235b2f commit 0acd084
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion pywhy_graphs/algorithms/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,6 @@ def possibly_directed_path(G, X: Optional[Set] = None, Y: Optional[Set] = None):
temp[1] = elem
x_neighbors.append(temp)


path_list = recursively_find_pd_paths(G, X, x_neighbors, Y)

return path_list
20 changes: 13 additions & 7 deletions pywhy_graphs/algorithms/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,10 @@ def test_possibly_directed():
admg.add_edge("K", "G", admg.directed_edge_name)
admg.add_edge("K", "H", admg.directed_edge_name)

Y = {"G","H"}
X = {"A","K"}
Y = {"G", "H"}
X = {"A", "K"}

correct = [{0: 'K', 1: 'G'}, {0: 'K', 1: 'H'}, {0: 'A', 1: 'G'}, {0: 'A', 1: 'H'}]
correct = [{0: "K", 1: "G"}, {0: "K", 1: "H"}, {0: "A", 1: "G"}, {0: "A", 1: "H"}]
out = pywhy_graphs.possibly_directed_path(admg, X, Y)
assert correct[0] == out[0]
assert correct[1] == out[1]
Expand Down Expand Up @@ -666,14 +666,13 @@ def test_possibly_directed():
{0: "A", 1: "G", 2: "C", 3: "H"},
{0: "Y", 1: "X", 2: "Z", 3: "K"},
{0: "Y", 1: "X", 2: "Z", 3: "C", 4: "H"},
{0: 'A', 1: 'G', 2: 'C', 3: 'Z', 4: 'K'},
{0: "A", 1: "G", 2: "C", 3: "Z", 4: "K"},
]
out = pywhy_graphs.possibly_directed_path(admg, X, Y)
assert correct[0] == out[0]
assert correct[1] == out[1]
assert correct[2] == out[2]


admg = PAG()
admg.add_edge("A", "G", admg.directed_edge_name)
admg.add_edge("G", "C", admg.directed_edge_name)
Expand All @@ -687,10 +686,17 @@ def test_possibly_directed():
Y = {"H", "K"}
X = {"Y", "A"}

correct = [[{0: 'Y', 1: 'X', 2: 'Z', 3: 'K'}, {0: 'Y', 1: 'X', 2: 'Z', 3: 'C', 4: 'H'}, {0: 'A', 1: 'G', 2: 'C', 3: 'H'}, {0: 'A', 1: 'G', 2: 'C', 3: 'Z', 4: 'K'}]]
correct = [
[
{0: "Y", 1: "X", 2: "Z", 3: "K"},
{0: "Y", 1: "X", 2: "Z", 3: "C", 4: "H"},
{0: "A", 1: "G", 2: "C", 3: "H"},
{0: "A", 1: "G", 2: "C", 3: "Z", 4: "K"},
]
]

out = pywhy_graphs.possibly_directed_path(admg, X, Y)
assert correct[0] == out[0]
assert correct[1] == out[1]
assert correct[2] == out[2]
assert correct[3] == out[3]
assert correct[3] == out[3]

0 comments on commit 0acd084

Please sign in to comment.