how to built a Cover tree from a given graph?

2 ビュー (過去 30 日間)
mazari ahmed
mazari ahmed 2015 年 3 月 29 日
コメント済み: mazari ahmed 2015 年 4 月 1 日
have a graph with an adjacency matrix l would like to built and visualize a cover tree from a given node (node 1 for exemple) . how can l proceed ? here is my code concerning the graph generated :
X=100;
Y=100;
N=50; %number of nodes
nodesX(1)=rand*X;
nodesY(1)=rand*Y;
for i=2:N
nodesX(i)=rand*X;
nodesY(i)=rand*Y;
d(i-1) =((nodesX(i)-nodesX(i-1)).^2+(nodesY(i)-nodesY(i-1)).^2).^0.5;
while (d(i-1)>200)
nodesX(i)=rand*X;
nodesY(i)=rand*Y;
d(i-1) =((nodesX(i)-nodesX(i-1)).^2+(nodesY(i)-nodesY(i-1)).^2).^0.5;
end
end
h_old=plot(nodesX,nodesY,'m*');
labels=[1:N]';
labels=num2str(labels);
text(nodesX,nodesY,labels);
xlabel('X (Meters)');
ylabel('Y (Meters)');
title(['Network Topology with',num2str(N),'nodes']);
hold on
A= zeros(N,N);
neighbour_n=cell(N,1);
m=0;
for k=1:N;
for j=1:N;
if (k~=j)
d=((nodesX(k)-nodesX(j))^2+(nodesY(k)-nodesY(j))^2)^0.5;
end
if (k~=j);
if(d < 50);
line([nodesX(k),nodesX(j)],[nodesY(k),nodesY(j)]);
neighbour_n{k}= [neighbour_n{k} j];
end
end
end;
end;
display(A);
  1 件のコメント
mazari ahmed
mazari ahmed 2015 年 4 月 1 日
Any suggestions

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeDirected Graphs についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by