diff options
author | Navya Agarwal <82928853+navyagarwal@users.noreply.github.com> | 2023-03-23 23:16:02 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-23 23:16:02 +0530 |
commit | 0a39ac07c22ae64837946294202c24adf0f5fb1d (patch) | |
tree | a233345269d85ed1b1f6f7c037702b22f2f3e9a2 /networkx | |
parent | 5d617714b5cbaf5648ed1d2b3369758399324f60 (diff) | |
download | networkx-0a39ac07c22ae64837946294202c24adf0f5fb1d.tar.gz |
Add docstring examples to boundary.py (#6487)
* Add docstring examples to boundary.py
* Change example to wheel_graph
Diffstat (limited to 'networkx')
-rw-r--r-- | networkx/algorithms/boundary.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/networkx/algorithms/boundary.py b/networkx/algorithms/boundary.py index 04d59de6..722d8521 100644 --- a/networkx/algorithms/boundary.py +++ b/networkx/algorithms/boundary.py @@ -59,6 +59,20 @@ def edge_boundary(G, nbunch1, nbunch2=None, data=False, keys=False, default=None are specified and `G` is a multigraph, then edges are returned with keys and/or data, as in :meth:`MultiGraph.edges`. + Examples + ------- + >>> G = nx.wheel_graph(6) + + When nbunch2=None: + + >>> list(nx.edge_boundary(G, (1, 3))) + [(1, 0), (1, 2), (1, 5), (3, 0), (3, 2), (3, 4)] + + When nbunch2 is given: + + >>> list(nx.edge_boundary(G, (1, 3), (2, 0))) + [(1, 0), (1, 2), (3, 0), (3, 2)] + Notes ----- Any element of `nbunch` that is not in the graph `G` will be @@ -121,6 +135,20 @@ def node_boundary(G, nbunch1, nbunch2=None): set The node boundary of `nbunch1` with respect to `nbunch2`. + Examples + ------- + >>> G = nx.wheel_graph(6) + + When nbunch2=None: + + >>> list(nx.node_boundary(G, (3, 4))) + [0, 2, 5] + + When nbunch2 is given: + + >>> list(nx.node_boundary(G, (3, 4), (0, 1, 5))) + [0, 5] + Notes ----- Any element of `nbunch` that is not in the graph `G` will be |