nxmetis.vertex_separator

nxmetis.vertex_separator(G, weight='weight', options=None)[source]

Compute a vertex separator that bisects a graph. The algorithm aims to minimize the sum of weights of vertices in the separator.

Parameters:
  • G (NetworkX graph) – A graph.
  • weight (object, optional) – The data key used to determine the weight of each node. If None, each node has unit weight. Default value: ‘weight’.
  • options (MetisOptions, optional) – METIS options. If None, the default options are used. Default value: None.
Returns:

sep, part1, part2 – The separator and the two parts of the bisection represented as lists.

Return type:

lists of nodes

Raises:

NetworkXError – If the parameters cannot be converted to valid METIS input format, or METIS returns an error status.