当前位置:网站首页>Minimum dominating set (MDS) and its matlab code
Minimum dominating set (MDS) and its matlab code
2022-07-29 00:35:00 【Love learning one by one】
List of articles
Preface
Minimum dominating set also plays an important role in network routing design , Next, let's study together ~
One 、 What is the minimum dominating set ?
The minimum dominating set , Full name M i n i m a l D o m i n a t i n g S e t Minimal\ Dominating\ Set Minimal Dominating Set, Referred to as M D S MDS MDS. For Graphs G = ( V , E ) G = (V, E) G=(V,E) Come on , set up V ′ V' V′ The picture is G G G A dominating set of , For any vertex in the graph u u u, Or belong to a collection V ′ V' V′, Or with V ′ V' V′ The vertices in the are adjacent to each other . stay V ′ V' V′ After removing any element from , V ′ V' V′ No longer a dominating set , Then dominating set V ′ V' V′ Is a minimal dominating set . call G G G The dominating set with the least number of vertices in all dominating sets is the minimum dominating set , The number of vertices in the minimum dominating set is called dominating number .
Two 、 Solution
1、 Greedy strategy
First, choose a point as the root , Then traverse according to the depth first to get the traversal sequence , Greedy according to the reverse sequence of the obtained sequence :
For a point that neither belongs to nor is connected to a point in the dominating set , If his parent node does not belong to the dominating set , Add its parent node to the dominating set , At the same time, its neighbor nodes are also marked .
2、 Pseudo code
First step : Traverse the whole tree with the root node depth first , Find the number of each point in the depth first traversal sequence and the parent node number of each point .
The second step : Check each point in the reverse order of depth first traversal ( I understand it as checking in the order of degrees from big to small ), If the current point does not belong to the dominating set and is not connected to the point of the dominating set , And its parent node does not belong to the dominating set , Add its parent node to the dominating set , The number of dominant concentration points plus 1, Mark current node , At the same time, its neighbor nodes are also marked .
The above two parts are referenced from the following website , And revised it according to my own understanding :
https://www.cnblogs.com/Kissheart/p/9939887.html
3、matlab Code
Radius=10;
D=[]; % Degrees ( The number of neighbor nodes of a node )
Node_Num=120; % Number of nodes
pointer=[]; %flag by 1 Set of points for
flag=zeros(1,Node_Num); % Mark the number that has been selected
A=zeros(Node_Num,Node_Num); % Construct adjacency matrix
% Calculation degree
for i=1:Node_Num
num=0;
for j=1:Node_Num
if i~=j
if [x(i)-x(j)]^2+[y(i)-y(j)]^2<=Radius^2 % If i and J Nodes can be adjacent
num=num+1; %i Degrees +1
A(i,j)=1; % Marked as 1, It means having a neighbor relationship
end
end
end
d(i)=num;
D=[D,d(i)];% Calculation degree % Degree relationship of all nodes
% Generate the minimum dominating set
for ss=1:Node_Num
if flag(ss)==0
max=D(ss);
j=ss;
for i=1:Node_Num
if max<D[i]...
&&flag(i)==0;
max=D(i);
j=i; % Find the vertex with the largest degree in turn
end
end
flag(j)=1;
for k=1:Node_Num
if A(j,k)==1
flag(k)=2; % The adjacent nodes are marked 2
end
end
end
end
The above code is mainly referenced from the following website and has been commented and modified , It's been tested , It can be used .
https://blog.csdn.net/ccsss22/article/details/115865567
summary
Finding the minimum dominating set can help us in The data transmission volume of some nodes is significantly larger than that of other nodes In the case of network routing design , The above knowledge is also summarized under my personal understanding and experiment , I hope you can learn some knowledge ~
边栏推荐
- flask与七牛云上传图片
- How to solve the problem that the Oracle instance cannot be started
- flask结合容联云发送验证码
- Idea connection database
- 110道 MySQL面试题及答案 (持续更新)
- Dynamic programming problem (1)
- ACM SIGIR 2022 | interpretation of selected papers of meituan technical team
- Shell编程规范与变量
- Introduction and solution of common security vulnerabilities in Web System SQL injection
- 17. Design of machine learning system
猜你喜欢
随机推荐
@Transactional 注解使用详解
【MySQL 8】Generated Invisible Primary Keys(GIPK)
Advanced area of attack and defense world web masters ics-06
MySQL事务(transaction) (有这篇就足够了..)
【飞控开发基础教程8】疯壳·开源编队无人机-I2C(激光测距)
Talk about seven ways to realize asynchronous programming
SAP VL02N 交货单过账函数 WS_DELIVERY_UPDATE
[small bug diary] Navicat failed to connect to MySQL | MySQL service disappeared | mysqld installation failed (this application cannot run on your computer)
CDN mode uses vant components, and components cannot be called after they are introduced
vscode下链接远程服务器安装插件失败、速度慢等解决方法
pnpm的安装与使用
Shell编程规范与变量
16.偏差、方差、正则化、学习曲线对模型的影响
MySQL 分库分表及其平滑扩容方案
Alibaba Code代码索引技术实践:为Code Review提供本地IDE的阅读体验
动态规划问题(六)
MQ 消息丢失、重复、积压问题,如何解决?
[ESN] learning echo state network
Installation and use of pnpm
动态规划问题(三)







