networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
min_weighted_dominating_set(G, weight=None)

Notes

This algorithm computes an approximate minimum weighted dominating set for the graph G. The returned solution has weight :None:None:`(\log w(V)) w(V^*)`, where :None:None:`w(V)` denotes the sum of the weights of each node in the graph and :None:None:`w(V^*)` denotes the sum of the weights of each node in the minimum weight dominating set for the graph.

This implementation of the algorithm runs in $O(m)$ time, where $m$ is the number of edges in the graph.

Parameters

G : NetworkX graph

Undirected graph.

weight : string

The node attribute storing the weight of an node. If provided, the node attribute with this key must be a number for each node. If not provided, each node is assumed to have weight one.

Returns

min_weight_dominating_set : set

A set of nodes, the sum of whose weights is no more than :None:None:`(\log w(V)) w(V^*)`, where :None:None:`w(V)` denotes the sum of the weights of each node in the graph and :None:None:`w(V^*)` denotes the sum of the weights of each node in the minimum weight dominating set.

Returns a dominating set that approximates the minimum weight node dominating set.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/approximation/dominating_set.py#21
type: <class 'function'>
Commit: