Ask Your Question
0

Is there any code to list all minimal k-distance dominating sets of a simple graph G in sagemath?

asked 1 year ago

anonymous user

Anonymous

A distance- k-dominating set S of a graph G is a set of its vertices of minimal cardinality such that any vertex of G is in S or is at distance at most k from a vertex in S.

I need to find all minimal distance 2- dominating sets of a simple graph G.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 1 year ago

updated 1 year ago

You can use method minimal_dominating_sets to list the minimal distance-2 dominating sets on a modified graph H. The modified graph H has an edge between u and v if these vertices are at distance at most 2 in G.

sage: G = graphs.PathGraph(5)
sage: H = G.copy()
sage: for u in G:
....:     H.add_edges((u, v) for v in G.breadth_first_search(u, distance=2) if u != v)
sage: for d in H.minimal_dominating_sets():
....:     print(d)
{0, 3}
{1, 3}
{2}
{0, 4}
{1, 4}
Preview: (hide)
link

Comments

This is now Issue 35461.

David Coudert gravatar imageDavid Coudert ( 1 year ago )

Thanks a lot dear sir..

vairas_sa gravatar imagevairas_sa ( 1 year ago )

i need some more help in code... can you help me sir?

vairas_sa gravatar imagevairas_sa ( 1 year ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 1 year ago

Seen: 194 times

Last updated: Apr 08 '23