ó žÃÒYc@sMdZddlmZdZddgZdeedd„Zdd„ZdS( sYRoutines to find the boundary of a set of nodes. An edge boundary is a set of edges, each of which has exactly one endpoint in a given set of nodes (or, in the case of directed graphs, the set of edges whose source node is in the set). A node boundary of a set *S* of nodes is the set of (out-)neighbors of nodes in *S* that are outside *S*. iÿÿÿÿ(tchains^Aric Hagberg (hagberg@lanl.gov) Pieter Swart (swart@lanl.gov) Dan Schult (dschult@colgate.edu)t edge_boundaryt node_boundarycs¤‡fd†|Dƒ‰|jƒrF|jˆd|d|d|ƒ}n|jˆd|d|ƒ}|dkr‡fd†|DƒSt|ƒ‰‡‡fd†|DƒS(smReturns the edge boundary of `nbunch1`. The *edge boundary* of a set *S* with respect to a set *T* is the set of edges (*u*, *v*) such that *u* is in *S* and *v* is in *T*. If *T* is not specified, it is assumed to be the set of all nodes not in *S*. Parameters ---------- G : NetworkX graph nbunch1 : iterable Iterable of nodes in the graph representing the set of nodes whose edge boundary will be returned. (This is the set *S* from the definition above.) nbunch2 : iterable Iterable of nodes representing the target (or "exterior") set of nodes. (This is the set *T* from the definition above.) If not specified, this is assumed to be the set of all nodes in `G` not in `nbunch1`. keys : bool This parameter has the same meaning as in :meth:`MultiGraph.edges`. data : bool or object This parameter has the same meaning as in :meth:`MultiGraph.edges`. default : object This parameter has the same meaning as in :meth:`MultiGraph.edges`. Returns ------- iterator An iterator over the edges in the boundary of `nbunch1` with respect to `nbunch2`. If `keys`, `data`, or `default` are specified and `G` is a multigraph, then edges are returned with keys and/or data, as in :meth:`MultiGraph.edges`. Notes ----- Any element of `nbunch` that is not in the graph `G` will be ignored. `nbunch1` and `nbunch2` are usually meant to be disjoint, but in the interest of speed and generality, that is not required here. cs"h|]}|ˆkr|’qS(((t.0tv(tnbunch1(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pys Ns tdatatkeystdefaultc3s3|])}|dˆk|dˆkAr|VqdS(iiN((Rte(tnset1(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pys ]sc3sU|]K}|dˆkr)|dˆksI|dˆkr|dˆkr|VqdS(iiN((RR (R tnset2(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pys _s N(t is_multigraphtedgestNonetset(tGRtnbunch2RRRR ((RR R sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pyRs5 $  csb‡fd†|Dƒ}ttj‡fd†|Dƒƒƒ|}|dk r^|t|ƒM}n|S(s|Returns the node boundary of `nbunch1`. The *node boundary* of a set *S* with respect to a set *T* is the set of nodes *v* in *T* such that for some *u* in *S*, there is an edge joining *u* to *v*. If *T* is not specified, it is assumed to be the set of all nodes not in *S*. Parameters ---------- G : NetworkX graph nbunch1 : iterable Iterable of nodes in the graph representing the set of nodes whose node boundary will be returned. (This is the set *S* from the definition above.) nbunch2 : iterable Iterable of nodes representing the target (or "exterior") set of nodes. (This is the set *T* from the definition above.) If not specified, this is assumed to be the set of all nodes in `G` not in `nbunch1`. Returns ------- set The node boundary of `nbunch1` with respect to `nbunch2`. Notes ----- Any element of `nbunch` that is not in the graph `G` will be ignored. `nbunch1` and `nbunch2` are usually meant to be disjoint, but in the interest of speed and generality, that is not required here. cs"h|]}|ˆkr|’qS(((Rtn(R(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pys ‰s c3s|]}ˆ|VqdS(N((RR(R(sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pys ŠsN(RRt from_iterableR(RRRR tbdy((Rsr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pyRds %) N( t__doc__t itertoolsRt __author__t__all__RtFalseRR(((sr/private/var/folders/w6/vb91730s7bb1k90y_rnhql1dhvdd44/T/pip-build-w4MwvS/networkx/networkx/algorithms/boundary.pyts    J