Azzera filtri
Azzera filtri

Broadcast Information within a network

2 visualizzazioni (ultimi 30 giorni)
Isaac Osei Agyemang
Isaac Osei Agyemang il 16 Ott 2018
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 Commenti
Walter Roberson
Walter Roberson il 16 Ott 2018
What does it mean to "broadcast information" in your network?
Isaac Osei Agyemang
Isaac Osei Agyemang il 16 Ott 2018
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Networks in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by