approx_minimum_dominating_set#
- graph_tool.structure.approx_minimum_dominating_set(g, weight=None, dset=None)[git][source]#
Return an approximate minimum (weighted) dominating set.
- Parameters:
- g
Graph Graph to be used.
- weight
VertexPropertyMap(optional, default:None) Positive vertex weights. If not given, every vertex has unit weight.
- dset
VertexPropertyMap(optional, default:None) If provided, the vertices of the set will be marked in this property map.
- g
- Returns:
- dset
VertexPropertyMap Boolean vertex property map marking the vertices of the set.
- dset
See also
connected_dominating_setConnected dominating set
approx_minimum_edge_dominating_setEdge counterpart
approx_minimum_vertex_coverApproximate minimum vertex cover
Notes
A dominating set contains, for every vertex, the vertex itself or one of its neighbors (for directed graphs, one of its in-neighbors). Finding one of minimum weight is NP-hard, and the greedy algorithm of Chvátal [chvatal-greedy-1979] is used, which repeatedly adds the vertex that dominates the most new vertices per unit weight. Its total weight is at most \(H(\Delta + 1)\approx \ln \Delta\) times the minimum, where \(\Delta\) is the largest degree. The algorithm runs in time \(O((V + E)\log V)\) in typical cases.
References
[chvatal-greedy-1979]Vašek Chvátal, “A greedy heuristic for the set-covering problem”, Mathematics of Operations Research 4, 233-235 (1979), DOI: 10.1287/moor.4.3.233 [sci-hub, @tor]
Examples
>>> g = gt.collection.data["karate"] >>> d = gt.approx_minimum_dominating_set(g) >>> print(d.fa.sum()) 4
The set can be highlighted in a drawing of the network:
>>> vcolor = g.new_vp("string", vals=np.where(d.a, "#f28c8e", "#cccccc")) >>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=vcolor, ... edge_color="#999999", ... output="approx_minimum_dominating_set-karate.pdf") <...>
Approximate minimum dominating set of Zachary’s karate club network, with its vertices shown in red.#