vertex_boundary#
- graph_tool.structure.vertex_boundary(g, S, T=None)[git][source]#
Return the vertex boundary of a set of vertices.
- Parameters:
- g
Graph Graph to be used.
- Siterable of
intorVertexPropertyMap Set of vertices, as a sequence of vertices or a Boolean vertex property map.
- Titerable of
intorVertexPropertyMap(optional, default:None) If given, the boundary is restricted to these vertices.
- g
- Returns:
- boundary
numpy.ndarray The vertices of the boundary, in increasing order.
- boundary
See also
edge_boundaryEdge counterpart
boundary_expansionBoundary size normalized by the size of the set
Notes
The vertex boundary of \(S\) is the set of (out-)neighbors of its vertices that are not in \(S\) (and are in \(T\), if given). The time is \(O(V + E)\).
Examples
>>> g = gt.collection.data["karate"] >>> print(gt.vertex_boundary(g, [0, 1, 2])) [ 3 4 5 6 7 8 9 10 11 12 13 17 19 21 27 28 30 31 32]
The set and its boundary can be shown in a drawing of the network:
>>> vcolor = g.new_vp("string", val="#cccccc") >>> for v in gt.vertex_boundary(g, [0, 1, 2]): ... vcolor[v] = "#f28c8e" >>> for v in [0, 1, 2]: ... vcolor[v] = "#9bbedc" >>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=vcolor, ... edge_color="#999999", output="vertex_boundary-karate.pdf") <...>
Vertex boundary (red) of the set of vertices 0, 1 and 2 (blue) of Zachary’s karate club network.#