-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbendiness_reduction.html
165 lines (128 loc) · 3.76 KB
/
bendiness_reduction.html
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.5/seedrandom.min.js"></script>
<script src="https://d3js.org/d3.v5.min.js"></script>
<script src="./lib/glpk.min.js"></script>
</head>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
margin: 5%;
}
svg {
margin: 1%;
background-color: white;
}
.algorithm_header {
font-size: 2em;
font-weight: bold;
margin-top: 100px;
margin-bottom: 20px;
}
.rowDiv {
margin-top: 20px;
}
</style>
<body>
</body>
<script src="./dist/dist.js"></script>
<script>
const svg_height = 500
const svg_width = 600
const svg_height_s = 300
const svg_width_s = 600
const svg_height_m = 800
const svg_width_m = 1600
const svg_height_l = 1600
const svg_width_l = 3200
const attr_height = 15
const table_width = 70
const depth_distance = 150
let header_height = attr_height
let table_vert_space = 100
var depth = 4;
var seed = "dkfjbnkddds."
var tableDistribution = [3, 3];
var attributeDistribution = [3, 5];
var sameEdgeDistribution = 0;
var randomEdgeDistribution = 1;
g = new GraphGenerator(depth, seed, tableDistribution, attributeDistribution, sameEdgeDistribution, randomEdgeDistribution)
g = g.generate()
g.setExactWeights()
g.sortGraph()
rowDiv = d3.select('body')
.append('div')
.html("<h1>Original</h1>")
svg = rowDiv
.append('div')
.style('width', '50%')
.append('svg')
.attr('class', 'vis-svg')
.attr('easypz', '{"applyTransformTo":"svg > *"}')
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 " + (2*svg_width) + " " + (1.5*svg_height))
drawGraph(svg, g)
// *********
// *********
rowDiv = d3.select('body')
.append('div')
.html("<h1>Bendiness reduction through heuristic</h1>")
let algorithm = new LPFormulation(g)
algorithm.arrange()
g.setExactWeights()
g.sortGraph()
g.adjustAttrOffset()
svg = rowDiv
.append('div')
.style('width', '50%')
.append('svg')
.attr('class', 'vis-svg')
.attr('easypz', '{"applyTransformTo":"svg > *"}')
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 " + (2*svg_width) + " " + (1.5*svg_height))
drawGraph(svg, g)
// *********
// *********
g = new GraphGenerator(depth, seed, tableDistribution, attributeDistribution, sameEdgeDistribution, randomEdgeDistribution)
g = g.generate()
rowDiv = d3.select('body')
.append('div')
.html("<h1>Bendiness reduction through LP</h1>")
algorithm = new LPFormulation(g)
algorithm.arrange()
g.setExactWeights()
g.sortGraph()
//g.adjustTableYPosition()
let algorithm2 = new LPBendiness(g)
algorithm2.arrange()
svg = rowDiv
.append('div')
.style('width', '50%')
.append('svg')
.attr('class', 'vis-svg')
.attr('easypz', '{"applyTransformTo":"svg > *"}')
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 " + (2*svg_width) + " " + (1.5*svg_height))
drawGraph(svg, g)
// *********
// *********
g = new GraphGenerator(depth, seed, tableDistribution, attributeDistribution, sameEdgeDistribution, randomEdgeDistribution)
g = g.generate()
rowDiv = d3.select('body')
.append('div')
.html("<h1>Bendiness and intersection reduction in a single LP problem</h1>")
algorithm = new LPBendinessCombinedPlusGroups(g)
algorithm.arrange()
svg = rowDiv
.append('div')
.style('width', '50%')
.append('svg')
.attr('class', 'vis-svg')
.attr('easypz', '{"applyTransformTo":"svg > *"}')
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 " + (2*svg_width) + " " + (1.5*svg_height))
drawGraph(svg, g)
</script>
</html>