Last active
March 3, 2018 04:46
-
-
Save aabajaj2/00d03fe935367b5d144da9ae7e957c02 to your computer and use it in GitHub Desktop.
Creates a matrix representation for the edges
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 | 4038 | 4014 | |
---|---|---|---|
1 | 4032 | 4027 | |
2 | 4019 | 4026 | |
3 | 4023 | 4003 | |
4 | 4018 | 3997 | |
5 | 4023 | 4031 | |
6 | 4021 | 3998 | |
7 | 4013 | 4004 | |
8 | 4023 | 4030 | |
9 | 4027 | 4032 | |
10 | 3988 | 4021 | |
11 | 3998 | 3982 | |
12 | 4031 | 4002 | |
13 | 4037 | 4020 | |
14 | 3995 | 3993 | |
15 | 4004 | 3995 | |
16 | 3982 | 3986 | |
17 | 4017 | 3983 | |
18 | 3994 | 3998 | |
19 | 3998 | 3999 | |
20 | 4014 | 3982 | |
21 | 3997 | 3994 | |
22 | 4005 | 3999 | |
23 | 3993 | 3995 | |
24 | 4009 | 3982 | |
25 | 4030 | 3993 | |
26 | 3991 | 3989 | |
27 | 3982 | 4021 | |
28 | 3982 | 4037 | |
29 | 4023 | 4004 | |
30 | 3997 | 4019 | |
31 | 3994 | 4019 | |
32 | 4031 | 4011 | |
33 | 4023 | 3997 | |
34 | 4030 | 4014 | |
35 | 3992 | 4017 | |
36 | 3981 | 3998 | |
37 | 3997 | 4018 | |
38 | 4009 | 4030 | |
39 | 3994 | 4018 | |
40 | 3995 | 4000 | |
41 | 4023 | 4014 | |
42 | 4000 | 4026 | |
43 | 4027 | 4038 | |
44 | 4027 | 4002 | |
45 | 4027 | 4020 | |
46 | 4030 | 4017 | |
47 | 4031 | 4038 | |
48 | 4009 | 3981 | |
49 | 4000 | 4021 | |
50 | 3986 | 4030 | |
51 | 3985 | 4014 | |
52 | 3994 | 4030 | |
53 | 3998 | 4021 | |
54 | 3994 | 4009 | |
55 | 3982 | 4023 | |
56 | 4023 | 4009 | |
57 | 3998 | 4019 | |
58 | 4014 | 3986 | |
59 | 4020 | 4031 | |
60 | 4009 | 4023 | |
61 | 3994 | 3997 | |
62 | 3993 | 3985 | |
63 | 4017 | 3986 | |
64 | 4011 | 594 | |
65 | 3995 | 3985 | |
66 | 3981 | 4023 | |
67 | 3995 | 3988 | |
68 | 3997 | 4030 | |
69 | 3997 | 4021 | |
70 | 4030 | 3997 | |
71 | 4000 | 3992 | |
72 | 3996 | 3994 | |
73 | 4038 | 3989 | |
74 | 4029 | 4001 | |
75 | 3989 | 594 | |
76 | 4025 | 4016 | |
77 | 4023 | 4034 | |
78 | 3993 | 4004 | |
79 | 4030 | 4019 | |
80 | 4030 | 3988 | |
81 | 3994 | 3996 | |
82 | 4026 | 4017 | |
83 | 4016 | 3990 | |
84 | 4031 | 3991 | |
85 | 4000 | 4030 | |
86 | 3998 | 4014 | |
87 | 4009 | 3998 | |
88 | 4004 | 4013 | |
89 | 4000 | 3995 | |
90 | 4016 | 4025 | |
91 | 3990 | 4016 | |
92 | 3999 | 4005 | |
93 | 4004 | 4023 | |
94 | 4002 | 4020 | |
95 | 3998 | 4018 | |
96 | 4011 | 3989 | |
97 | 4003 | 3982 | |
98 | 4021 | 3982 | |
99 | 4002 | 3998 | |
100 | 4031 | 4020 | |
101 | 3985 | 3995 | |
102 | 3988 | 3985 | |
103 | 3989 | 3991 | |
104 | 4000 | 4017 | |
105 | 4003 | 4009 | |
106 | 3997 | 3981 | |
107 | 3982 | 4030 | |
108 | 3982 | 3994 | |
109 | 3998 | 4005 | |
110 | 3995 | 4014 | |
111 | 4021 | 4030 | |
112 | 4005 | 3998 | |
113 | 4023 | 3998 | |
114 | 594 | 4011 | |
115 | 3993 | 4030 | |
116 | 4020 | 4030 | |
117 | 3989 | 4038 | |
118 | 3989 | 4011 | |
119 | 4019 | 3994 | |
120 | 4030 | 4020 | |
121 | 4009 | 4019 | |
122 | 4004 | 4020 | |
123 | 3995 | 4026 | |
124 | 4023 | 3981 | |
125 | 4020 | 4002 | |
126 | 4014 | 3985 | |
127 | 4017 | 4026 | |
128 | 3989 | 4013 | |
129 | 4038 | 4023 | |
130 | 4023 | 4002 | |
131 | 4020 | 4037 | |
132 | 3998 | 4002 | |
133 | 4013 | 3989 | |
134 | 3995 | 4023 | |
135 | 4021 | 3988 | |
136 | 3983 | 4017 | |
137 | 4004 | 3993 | |
138 | 4021 | 4000 | |
139 | 3999 | 4036 | |
140 | 4026 | 4019 | |
141 | 4033 | 3986 | |
142 | 4023 | 3995 | |
143 | 3982 | 3997 | |
144 | 3998 | 3981 | |
145 | 3990 | 4007 | |
146 | 3985 | 3988 | |
147 | 4018 | 3981 | |
148 | 4018 | 4030 | |
149 | 4025 | 3990 | |
150 | 4026 | 4030 | |
151 | 4021 | 3997 | |
152 | 3997 | 4023 | |
153 | 4031 | 594 | |
154 | 3996 | 4028 | |
155 | 3982 | 3988 | |
156 | 4012 | 3987 | |
157 | 4021 | 4017 | |
158 | 3988 | 4030 | |
159 | 4013 | 4023 | |
160 | 4025 | 4007 | |
161 | 4014 | 4021 | |
162 | 4030 | 4004 | |
163 | 4014 | 4037 | |
164 | 3986 | 4021 | |
165 | 4017 | 4021 | |
166 | 3982 | 4009 | |
167 | 4016 | 4007 | |
168 | 3998 | 4023 | |
169 | 3998 | 4009 | |
170 | 4007 | 3990 | |
171 | 594 | 3989 | |
172 | 4009 | 3997 | |
173 | 3992 | 4000 | |
174 | 4011 | 4031 | |
175 | 3986 | 3982 | |
176 | 4019 | 4030 | |
177 | 4020 | 4038 | |
178 | 4020 | 4004 | |
179 | 4021 | 4014 | |
180 | 4023 | 3982 | |
181 | 4017 | 4000 | |
182 | 3997 | 3998 | |
183 | 3993 | 3988 | |
184 | 4030 | 3994 | |
185 | 4023 | 4038 | |
186 | 4004 | 4031 | |
187 | 4027 | 4031 | |
188 | 4014 | 4038 | |
189 | 3986 | 4000 | |
190 | 4019 | 3997 | |
191 | 3982 | 4003 | |
192 | 3986 | 4033 | |
193 | 4030 | 4003 | |
194 | 4030 | 4018 | |
195 | 3981 | 3994 | |
196 | 4004 | 4038 | |
197 | 4009 | 4003 | |
198 | 3985 | 3993 | |
199 | 4000 | 4033 | |
200 | 4013 | 4038 | |
201 | 4018 | 4023 | |
202 | 4036 | 3999 | |
203 | 4003 | 4030 | |
204 | 4019 | 4009 | |
205 | 4030 | 4023 | |
206 | 4026 | 4021 | |
207 | 4019 | 3981 | |
208 | 3990 | 4025 | |
209 | 4023 | 4018 | |
210 | 4021 | 3986 | |
211 | 4030 | 4009 | |
212 | 3986 | 4026 | |
213 | 4038 | 4020 | |
214 | 4014 | 3995 | |
215 | 3996 | 4002 | |
216 | 4031 | 4004 | |
217 | 4001 | 4029 | |
218 | 4038 | 4013 | |
219 | 4014 | 4030 | |
220 | 4020 | 4027 | |
221 | 3988 | 3982 | |
222 | 3998 | 3994 | |
223 | 3982 | 3998 | |
224 | 4033 | 4000 | |
225 | 3988 | 3993 | |
226 | 4002 | 4031 | |
227 | 3998 | 3997 | |
228 | 3988 | 3995 | |
229 | 4037 | 3982 | |
230 | 3994 | 3982 | |
231 | 4018 | 3994 | |
232 | 3986 | 4014 | |
233 | 4003 | 4023 | |
234 | 4037 | 4014 | |
235 | 4026 | 3995 | |
236 | 3981 | 4019 | |
237 | 3999 | 3998 | |
238 | 3997 | 4009 | |
239 | 4026 | 4000 | |
240 | 4014 | 4023 | |
241 | 4004 | 4030 | |
242 | 4038 | 4027 | |
243 | 4006 | 4027 | |
244 | 594 | 4031 | |
245 | 4007 | 4025 | |
246 | 4038 | 4004 | |
247 | 3981 | 4018 | |
248 | 3981 | 3997 | |
249 | 4023 | 4013 | |
250 | 3982 | 4026 | |
251 | 4014 | 4017 | |
252 | 4009 | 3994 | |
253 | 3991 | 4031 | |
254 | 4000 | 3986 | |
255 | 3994 | 3981 | |
256 | 4018 | 3998 | |
257 | 3987 | 4012 | |
258 | 4019 | 3998 | |
259 | 4030 | 4026 | |
260 | 4007 | 4016 | |
261 | 4030 | 4000 | |
262 | 4017 | 4014 | |
263 | 3995 | 4004 | |
264 | 3997 | 3982 | |
265 | 4014 | 3998 | |
266 | 4017 | 4030 | |
267 | 4002 | 4023 | |
268 | 3994 | 4023 | |
269 | 4004 | 3985 | |
270 | 4026 | 3982 | |
271 | 4034 | 4023 | |
272 | 4030 | 3982 | |
273 | 4023 | 3994 | |
274 | 4002 | 3996 | |
275 | 3982 | 4014 | |
276 | 3981 | 4009 | |
277 | 4021 | 4026 | |
278 | 4030 | 3986 | |
279 | 4013 | 4031 | |
280 | 4026 | 3986 | |
281 | 4027 | 4006 | |
282 | 4030 | 4021 | |
283 | 3986 | 4017 | |
284 | 4017 | 3992 | |
285 | 4038 | 4031 | |
286 | 4031 | 4023 | |
287 | 4031 | 4027 | |
288 | 4002 | 4027 | |
289 | 4031 | 4013 | |
290 | 4028 | 3996 | |
291 | 3985 | 4004 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.6.0/p5.js"></script> | |
<script src="Matrix.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var table; | |
var xaxis = []; | |
var yaxis = []; | |
var xvertices = []; | |
var yvertices = []; | |
function preload() { | |
//my table is comma separated value "csv“ and has a header specifying the columns labels | |
table = loadTable('a3980edges.csv', 'csv'); | |
} | |
function setup() { | |
//count the columns | |
var width = 2000, height = 2000, margin = 20, | |
w = width - 2 * margin, | |
h = height - 2 * margin; | |
var columnforx = 22, columnfory = 20; | |
createCanvas(width, height); | |
for (var i = 0; i < table.getRowCount(); i++) { | |
yaxis[i] = table.getNum(i, 2); | |
xaxis[i] = table.getNum(i, 1); | |
if(!xvertices.includes(table.getNum(i, 1))){ | |
xvertices.push(table.getNum(i, 1)); | |
} | |
if(!yvertices.includes(table.getNum(i, 2))){ | |
yvertices.push(table.getNum(i, 2)); | |
} | |
} | |
print("Length xaxis= ", xaxis.length, yaxis.length); | |
print("Length = ", xvertices.length, yvertices.length); | |
xvertices.sort(function(a, b){return a-b}); | |
yvertices.sort(function(a, b){return a-b}); | |
minx = min(xaxis); | |
miny = min(yaxis); | |
maxx = max(xaxis); | |
maxy = max(yaxis); | |
print("Maxx and maxy="+maxx+" "+ maxy); | |
print("Minx and miny="+minx+" "+ miny); | |
// noLoop(); | |
} | |
function draw(){ | |
xstart = 50; | |
xend = 1900; | |
ystart = 50; | |
yend = 1900; | |
space = (xend-xstart)/(xvertices.length); shift = 10; | |
background(255); | |
fill("black"); | |
stroke(2); | |
//The square box | |
line(xstart, yend, xstart, ystart); | |
line(xstart, yend, xend, yend); | |
line(xstart, ystart, xend, ystart ); | |
line(xend, ystart, xend, yend); | |
//Plot squares | |
for (var i = 0; i<xaxis.length; i++) { | |
fill("pink"); | |
for (var j = 0; j <xvertices.length; j++) { | |
line(xstart+j*space,ystart,xstart+j*space,yend); | |
line(xstart,ystart+j*space,xend,ystart+j*space); | |
if (xaxis[i]==xvertices[j]){ | |
for (var k = 0; k < yvertices.length; k++) { | |
if (yvertices[k]==yaxis[i]){ | |
posx = xstart + ((xend-xstart)*j/xvertices.length); | |
posy = ystart + ((yend-ystart)*k/yvertices.length); | |
if (mouseX<=posx+space && mouseX>=posx && mouseY<=posy+space && mouseY>=posy){ | |
fill("black");pos_string=""+xvertices[j]+","+yvertices[k]; | |
text(pos_string,posx+space,posy+space);fill("aqua"); | |
} | |
rect(posx, posy, space, space);fill("pink"); | |
} | |
} | |
} | |
} | |
} | |
//labels | |
fill('black'); | |
textSize(12); | |
labelposx = 20; | |
for (var i = 0; i < xvertices.length; i++) { | |
labelposy = shift + (ystart + (((yend-ystart)*i)/xvertices.length)); | |
text(xvertices[i], labelposx, labelposy); | |
} | |
labelposy = 40; | |
for (var i = 0; i < yvertices.length; i++) { | |
labelposx = shift+ (xstart + (((xend-xstart)*i)/yvertices.length)); | |
text(yvertices[i], labelposx, labelposy); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment