-
Notifications
You must be signed in to change notification settings - Fork 0
/
visual_graph.m
41 lines (32 loc) · 1.45 KB
/
visual_graph.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%% build graph
s = [1,1,2,3,4,5,3,4,5,6,7,8,9,10,...
7,8,10,11,12,13,14,12,13,15,16,17,18,...
16,17,18,19];
t = [2,3,6,4,5,6,7,9,10,11,8,9,10,11,...
12,13,14,15,13,14,15,16,17,19,17,18,19,...
20,21,22,23];
weight = [sum(C(:,1)), sum(C(1,1:20)), sum(C(100,1:20)), sum(C(1:50,20)), sum(C(50:75,20)), sum(C(76:100,20)),...
sum(C(1,20:40)),sum(C(50,20:40)),sum(C(80,20:40)),sum(C(100,20:40)),sum(C(1:20, 40)), sum(C(21:50, 40)), sum(C(50:80, 40)), sum(C(80:100, 40)),...
sum(C(1, 40:60)),sum(C(20, 40:60)),sum(C(80, 40:60)),sum(C(100, 40:60)),sum(C(1:20, 60)),sum(C(20:80, 60)), sum(C(80:20, 60)),...
sum(C(1, 60:80)),sum(C(20, 60:80)),sum(C(100, 60:80)), sum(C(1:20, 80)),sum(C(20:80, 80)), sum(C(80:100, 80)),...
sum(C(1, 80:100)), sum(C(20, 80:100)), sum(C(80, 80:100)),sum(C(100, 80:100))];
G = graph(s,t,weight);
coordiXY = [0,5;0 0;1,5;1,2.5;1,1;1,0;
2,5;2,4;2,2.5;2,1;2,0;
3,5;3,4;3,1;3,0;
4,5;4,4;4,1;4,0;
5,5;5,4;5,1;5,0]/5*100;
%
x = coordiXY(:,1); y = coordiXY(:,2);
h = plot(G, 'XData', x, 'YData', y, 'EdgeLabel', G.Edges.Weight);
title('concentration sum along roadmap (10 percent leak)');
xlabel('x(m)');
ylabel('y(m)');
%% plot path
p1 = [1,3,4];
p2 = [1,3,7,12,13];
p3 = [1,3,7,8,13,12,16,17,18];
p4 = [1,3,4,5,10,9,8,13,12,16,17,18,22];
%%
highlight(h,p4,'EdgeColor','red');
legend('path')