is_separator

Contents

is_separator#

graph_tool.flow.is_separator(g, S)[git][source]#

Test whether a set of vertices is a separator of the graph.

Parameters:
gGraph

Graph to be used. If it is directed, it is treated as undirected.

Siterable of Vertex or VertexPropertyMap

The vertex set, or a Boolean vertex property map that marks it.

Returns:
is_separatorbool

True if \(S\) is a separator.

See also

is_minimal_separator

Test for minimal vertex separators

all_minimal_separators

All minimal vertex separators

Notes

The set \(S\) is a separator if there are two vertices not in \(S\) that are connected in the graph, but not after the vertices of \(S\) are removed (so that a graph that is already disconnected is not separated by the empty set). The test takes time \(O(V + E)\).

Examples

>>> g = gt.Graph([(0, 1), (1, 2), (2, 3), (3, 4), (4, 1)], directed=False)
>>> print(gt.is_separator(g, [1]), gt.is_separator(g, [2]))
True False