networkx.algorithms.boundary.node_boundary

node_boundary(G, nbunch1, nbunch2=None)[source]

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
GNetworkX graph
nbunch1iterable

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.)

nbunch2iterable

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.