summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavya Agarwal <82928853+navyagarwal@users.noreply.github.com>2023-03-23 23:12:17 +0530
committerGitHub <noreply@github.com>2023-03-23 23:12:17 +0530
commita41a11e516f4345d84ed356433cd543aab914643 (patch)
tree0cd856961a5f92b653419ff6641109b54277be5a
parent8b31e55d5232f5a6b8fe1adeb8c06e97eb3ed993 (diff)
downloadnetworkx-a41a11e516f4345d84ed356433cd543aab914643.tar.gz
Add docstring examples to dag.py (#6491)
* Docstr examples for compute-v-structures * Removed unnecessary example
-rw-r--r--networkx/algorithms/dag.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/networkx/algorithms/dag.py b/networkx/algorithms/dag.py
index 0d719e71..20968123 100644
--- a/networkx/algorithms/dag.py
+++ b/networkx/algorithms/dag.py
@@ -1224,6 +1224,13 @@ def compute_v_structures(G):
The v structures within the graph. Each v structure is a 3-tuple with the
parent, collider, and other parent.
+ Examples
+ --------
+ >>> G = nx.DiGraph()
+ >>> G.add_edges_from([(1, 2), (0, 5), (3, 1), (2, 4), (3, 1), (4, 5), (1, 5)])
+ >>> list(nx.compute_v_structures(G))
+ [(0, 5, 4), (0, 5, 1), (1, 5, 4)]
+
Notes
-----
https://en.wikipedia.org/wiki/Collider_(statistics)