1
- from typing import List , Union
1
+ from typing import List , Set , Union
2
2
3
3
import networkx as nx
4
4
@@ -343,7 +343,7 @@ def _directed_sub_graph_ancestors(G, node: Node):
343
343
----------
344
344
G : Graph
345
345
The graph.
346
- node : node label
346
+ node : Node
347
347
The node for which we have to find the ancestors.
348
348
349
349
Returns
@@ -362,7 +362,7 @@ def _directed_sub_graph_parents(G, node: Node):
362
362
----------
363
363
G : Graph
364
364
The graph.
365
- node : node label
365
+ node : Node
366
366
The node for which we have to find the parents.
367
367
368
368
Returns
@@ -381,7 +381,7 @@ def _bidirected_sub_graph_neighbors(G, node: Node):
381
381
----------
382
382
G : Graph
383
383
The graph.
384
- node : node label
384
+ node : Node
385
385
The node for which we have to find the neighbors.
386
386
387
387
Returns
@@ -408,7 +408,7 @@ def _is_collider(G, prev_node: Node, cur_node: Node, next_node: Node):
408
408
The previous node in the path.
409
409
cur_node : node
410
410
The node to be checked.
411
- next_node:
411
+ next_node: Node
412
412
The next node in the path.
413
413
414
414
Returns
@@ -429,10 +429,10 @@ def _shortest_valid_path(
429
429
G ,
430
430
node_x : Node ,
431
431
node_y : Node ,
432
- L : set ,
433
- S : set ,
434
- visited : set ,
435
- all_ancestors : set ,
432
+ L : Set ,
433
+ S : Set ,
434
+ visited : Set ,
435
+ all_ancestors : Set ,
436
436
cur_node : Node ,
437
437
prev_node : Node ,
438
438
):
@@ -448,13 +448,13 @@ def _shortest_valid_path(
448
448
The source node.
449
449
node_y : node
450
450
The destination node
451
- L : set
451
+ L : Set
452
452
Set containing all the non-colliders.
453
- S : set
453
+ S : Set
454
454
Set containing all the colliders.
455
- visited : set
455
+ visited : Set
456
456
Set containing all the nodes already visited.
457
- all_ancestors : set
457
+ all_ancestors : Set
458
458
Set containing all the ancestors a collider needs to be checked against.
459
459
cur_node : node
460
460
The current node.
@@ -515,7 +515,7 @@ def _shortest_valid_path(
515
515
return (path_exists , path )
516
516
517
517
518
- def inducing_path (G , node_x : Node , node_y : Node , L : set = None , S : set = None ):
518
+ def inducing_path (G , node_x : Node , node_y : Node , L : Set = None , S : Set = None ):
519
519
"""Checks if an inducing path exists between two nodes as defined in :footcite:`Zhang2008`.
520
520
521
521
Parameters
@@ -526,9 +526,9 @@ def inducing_path(G, node_x: Node, node_y: Node, L: set = None, S: set = None):
526
526
The source node.
527
527
node_y : node
528
528
The destination node.
529
- L : set
529
+ L : Set
530
530
Nodes that are ignored on the path. Defaults to an empty set. See Notes for details.
531
- S: set
531
+ S: Set
532
532
Nodes that are always conditioned on. Defaults to an empty set. See Notes for details.
533
533
534
534
Returns
0 commit comments