-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.html
More file actions
executable file
·64 lines (53 loc) · 1012 Bytes
/
main.html
File metadata and controls
executable file
·64 lines (53 loc) · 1012 Bytes
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title>Graph Coloring Prob !</title>
<script src="./js/node.js"></script>
<style >
@import url(./css/node.css);
</style>
</head>
<body >
<h1>Vertex coloring problem </h1>
<canvas id = "node" ></canvas>
<div class="sidebar">
Welcome to Canvas<br>
To Draw<br>
1 click - create a node
click 2 nodes - an edge
Maximum of 10 colors provided
</div>
<script>
function node(id, x, y, adj, color) {
this.id = id;
this.x = x;
this.y = y;
this.adj = adj;
this.color = color;
}
var i = 0;
var nodes = [];
{% for keys in cord.items %}
nodes[i] = new node(i, {{ keys.1.0 }}, {{ keys.1.1 }}, [], 0);
i++;
{% endfor %}
i = 0;
{% for keys in adj.items %}
nodes[i].adj = {{keys.1}};
i++;
{% endfor %}
i = -1;
{% for keys in color.items %}
{% if keys.1 %}
i += 1;
{% for key in keys.1 %}
nodes[{{key}}].color = i;
{% endfor %}
{% endif %}
{% endfor %}
init(nodes);
</script>
</body>
</html>