Plotting data from GML files
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
0 投票
Please can someone help me the plotting of data from a gml file, never worked with such file before. The dataset can be downloaded from http://www-personal.umich.edu/~mejn/netdata/dolphins.zip
採用された回答
fileName = 'dolphins.gml';
inputfile = fopen(fileName);
l=0;
k=1;
A = zeros([],2) ;
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 ~isempty(nums)
if l==1
l=0;
A(k,2)=str2double(nums{1});
k=k+1;
continue;
end
A(k,1)=str2double(nums{1});
l=1;
else
l=0;
continue;
end
end
fclose(inputfile) ;
G = zeros([],[]) ;
for i=1:length(A)
G(A(i,1)+1,A(i,2)+1) = 1;
G(A(i,2)+1,A(i,1)+1) = 1;
end
figure
g = graph(G) ;
plot(g)
figure
L=diag(sum(G))-G;
[v,~]=eig(L);
xy=v(:,[2 3]) ;
gplot(G,xy,'.-r')
8 件のコメント
Isaac Osei Agyemang
2018 年 9 月 25 日
Please I've seen it before, I'm new to matlab and i want to plot the data in that file in a form of a graph, dont have any idea of that, can you help me.
KSSV
2018 年 9 月 25 日
The data is read and Adjacency matrix can be created.....can you show me how the output is? Any pictorial example?
Isaac Osei Agyemang
2018 年 9 月 25 日
this is how i'm expecting it in matlab, i used a visualizer called gephi to plot it, but i want to use matlab so i can compute some analysis the gephi can't do.
Isaac Osei Agyemang
2018 年 9 月 25 日
編集済み: Isaac Osei Agyemang
2018 年 9 月 25 日
I get this error when i use the code you wrote.
Error using fgets Invalid file identifier. Use fopen to generate a valid file identifier.
Error in fgetl (line 32) [tline,lt] = fgets(fid);
Error in Dol (line 8) tline = fgetl(inputfile);
and when i changed it to fopen, it runs without any error but the graph does not show.
KSSV
2018 年 9 月 25 日
See to it that..the .gml file is present in the folder where code is run.
Isaac Osei Agyemang
2018 年 9 月 26 日
Please the file is in the same location but am not getting any output
KSSV
2018 年 9 月 26 日
You getting any error?
Isaac Osei Agyemang
2018 年 9 月 26 日
yes please, it runs without any output, I've got the dataset in a mat file, can I send it to you via email?
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graphics についてさらに検索
タグ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
