• API
• FAQ
• Tools
• Archive
SHARE
TWEET

lab

a guest Apr 10th, 2020 131 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. num = 0;
2. W = [0,7,num,3,4,num,7,num;
3.     5,0,num,8,num,5,num,8;
4.     num,3,0,6,num,4,num,7;
5.     5,8,6,0,9,7,num,num;
6.     5,8,7,6,0,5,num,3;
7.     3,num,num,8,num,0,8,4;
8.     num,7,num,num,num,6,0,9;
9.     7,num,6,num,num,num,4,0];
10. A = [0,1,0,1,1,0,1,0;
11.     1,0,0,1,0,1,0,1;
12.     0,1,0,1,0,1,0,1;
13.     1,1,1,0,1,1,0,0;
14.     1,1,1,1,0,1,0,1;
15.     1,0,0,1,0,0,1,1;
16.     0,1,0,0,0,1,0,1;
17.     1,0,1,0,0,0,1,0];
18. names = {'A','B','C','D','E','F','G','H',};
19. G = digraph(W, names);
20. p = plot(G,'EdgeLabel', G.Edges.Weight);
21. num = 10000;
22. W = [0,7,num,3,4,num,7,num;
23.     5,0,num,8,num,5,num,8;
24.     num,3,0,6,num,4,num,7;
25.     5,8,6,0,9,7,num,num;
26.     5,8,7,6,0,5,num,3;
27.     3,num,num,8,num,0,8,4;
28.     num,7,num,num,num,6,0,9;
29.     7,num,6,num,num,num,4,0];
30. W1 = W;
31. n = size(W,1);
32. for k = 1:n
33.     for i = 1:n
34.         for j = 1:n
35.             W1(i,j) = min(W1(i,j), W(i,k) + W(k,j));
36.         end
37.     end
38. end
39.
40.
41. sim_A1 = triu(A) + transpose(triu(A,1));
42. sim_A2 = triu(transpose(A)) + transpose(triu(transpose(A),1));
43. A3 = sim_A2+sim_A1;
44. sim_A = A3;
45. for i = 1:n
46.     for j = 1:n
47.         if A3(i,j) ~= 0
48.             sim_A(i,j) = 1;
49.         end
50.     end
51. end
52.
53. D = A3;
54. sum_line = 0;
55.
56. for i = 1:n
57.     for j = 1:n
58.         if i == j
59.             for k = 1:n
60.                 sum_line = sum_line + sim_A(i,k);
61.             end
62.             D(i,j) = sum_line;
63.             sum_line = 0;
64.         else
65.             D(i,j) = 0;
66.         end
67.     end
68. end
69.
70.
71.
72. % D = [6,0,0,0,0,0,0,0;
73. %     0,7,0,0,0,0,0,0;
74. %     0,0,5,0,0,0,0,0;
75. %     0,0,0,5,0,0,0,0;
76. %     0,0,0,0,6,0,0,0;
77. %     0,0,0,0,0,7,0,0;
78. %     0,0,0,0,0,0,4,0;
79. %     0,0,0,0,0,0,0,6];
80. K = D - sim_A;
81. N = ((-1)^16)*det(K(1:7,1:7));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top