필터 지우기
필터 지우기

Broadcast Information within a network

조회 수: 2 (최근 30일)
Isaac Osei Agyemang
Isaac Osei Agyemang 2018년 10월 16일
댓글: Isaac Osei Agyemang 2018년 10월 16일
Hello community, I have a complex network (graph), I want to randomly pick one node and let the node broadcast information through the network based on the average distance of the network. Can some please help....I've no idea how to implement this. Graph data set (Power Grid) can be downloaded from http://www-personal.umich.edu/~mejn/netdata/. Below is my code for reading and ploting the graph.
%Extracting edges from gml file graph
fileName = 'power.gml';
inputfile = fopen(fileName);
Edges=[];
l=0;
k=1;
while 1
% Get a line from the input file
tline = fgetl(inputfile);
% Quit if end of file
if ~ischar(tline)
break
end
nums = regexp(tline,'\d+','match');
if length(nums)
if l==1
l=3;
Edges(k,2)=str2num(nums{1});
k=k+1;
continue;
end
Edges(k,1)=str2num(nums{1});
l=1;
else
l=0;
continue;
end
end
Edges = Edges+1;
NewEdge = Edges;
%Edges(:,1:2) = sort(Edges(:,1:2));
Edges = unique(Edges(:,1:2),'rows','stable');
G = graph(Edges(:,1), Edges(:,2)); % create a graph from A
deg = degree(G);
figure % visualize the graph
plot(G);
title('Power Grid, Before Movement')
NewEdge = NewEdge(randperm(size(NewEdge,1)),:); % <-- Optional --
nodesize = numnodes(G);
size = nodesize;
not = [];
x = [];
for c = 1:size
[P,d] = shortestpath(G,c,nodesize);
if d == Inf
not = [not, d];
else
x = [x, d];
end
end
LongestShortestPath = max(x)
disp('Before Change');
AverageDistance = mean(x)
AverageDegree = mean(deg)
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 10월 16일
What does it mean to "broadcast information" in your network?
Isaac Osei Agyemang
Isaac Osei Agyemang 2018년 10월 16일
lets say sending a random letter generated between a to z. So assuming that node 1 has a degree of 3; thus it has 3 nodes connected to it, it should send the random letter generated to these 3 nodes.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by