-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
155 lines (142 loc) · 6.97 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Percolation - Epidemic Graph</title>
<link rel="stylesheet" type="text/css" href="./css/app.css">
<link rel="stylesheet" type="text/css" href="./css/WinJS-ui-light.css">
</head>
<body style="overflow-y: scroll;">
<div id="page-container" style="width: 962px; position: relative; margin: 0 auto;">
<h1>Epidemic Graph</h1>
<br>
<section id="about">
<h2>About</h2>
<p>Epidemic Graph is an interactive <a href="http://en.wikipedia.org/wiki/Graph_(mathematics)">graph</a> modeling the spread of epidemics.</p>
</section>
<section id="app" width="960px" height="480px" style="position: relative; overflow: hidden;">
<h2>App</h2>
<div id="app-body" width="960px" height="480px"
style="position: relative; overflow: hidden; border: 1px solid #e3e3e3; border-radius: 4px;">
<div id="edit-panel" style="float: left; width: 298px; height: 480px; padding: 10px; border-right: 1px solid #e3e3e3; background-color: #f5f5f5">
<div>
<p>Properties for selected node:</p>
<div style="color: #3a87ad; background-color: #d9edf7; border-color: #bce8f1; padding: 8px 35px 8px 14px; margin-bottom: 20px;">
<table id="selected_properties" width="100%">
<tr>
<td width="50%">Infected? </td>
<td width="50%">
<select id="infectionSelect">
<option disabled="true">select a node</option>
</select>
</td>
</tr>
<tr>
<td width="50%">Threshold: </td>
<td width="50%">
<select id="thresholdSelect">
<option disabled="true">select a node</option>
</select>
</td>
</tr>
</table>
</div>
</div>
<div style="position: relative; padding-top: 10px; border-top: 1px solid #e3e3e3; padding-bottom: 10px">
<table width="100%" style="text-align: center;">
<tr>
<td width="33%"><button id="runButton" title="Start epidemics!" onclick="run_click()">Run</button></td>
<td width="34%"><button title="Reset infection status." onclick="reset_click()">Reset</button></td>
<td width="33%"><button title="Download the current graph." onclick="saveGraph_click()">Save</button></td>
</tr>
</table>
</div>
<div style="position: relative; padding-top: 10px; border-top: 1px solid #e3e3e3;">
<p>Directions:</p>
<ul>
<li>Click in open space to <strong>add a node</strong></li>
<li>Drag between nodes to <strong>add an edge</strong></li>
<li>Ctrl-drag a node to <strong>move</strong> it</li>
<li>Click a node or an edge to <strong>select</strong> it</li>
<li>
When a/an node/edge is selected, <strong>delete</strong> removes the node/edge,
and <strong>escape</strong> cancels selection
</li>
<li>
<strong><font color="red">Red</font></strong> means <strong>infected</strong>
<br>
<strong><font color="blue">Blue</font></strong> means <strong>not infected</strong>
</li>
</ul>
</div>
</div>
<div id="graph" style="float: left; width: 640 px; height: 480px;"></div>
<div id="epidemicsStatus">Status: (Idle)</div>
</div>
<div id="loadFile" style="width: 960px;">
<p>
Alternatively, you can upload your graph. (See note in 'Detail Information' section)
</p>
<div id="fileInput" style="height: 32px;">
<input type="file" id="files" style="min-width: 85px; width: 85px;" />
<output id="list"></output>
</div>
</div>
</section>
<br>
<section id="details">
<h2>Detailed information</h2>
<p>
In Epidemic Graph, each node is a person who may or may not be infected. Each edge means a connection between two persons.
</p>
<p>
Initially, you can set some people to be infected. Once started, in each round, infection spreads as follow: For each person, if the number of infected neighbors is greater than or equal to the preset threshold, then the person becomes infected.
</p>
<p>
Simulation runs at 1 second per round, and it stops when there are no more changes in infected people.
</p>
<p>
Note: Graph file must be in the following format. Also, the number of elements in line 1 must be equal to the number of elements in line 3. Click <a href="./example_graph.txt">here</a> for an example graph (Icosahedron) file.
</p>
<ul>
<li>line 1: [Id1, Id2, Id3, ...]</li>
<li>line 2: [(Src1, Dest1), (Src2, Dest2), ...]</li>
<li>line 3: [Thres1, Thres2, Thres3, ...]</li>
</ul>
<p>Some grids are pre-built for your convenience:</p>
<ul>
<li>Hexagon grid (face) - Click <a href="./Hexagon/index.html">here</a>.</li>
<li>Square grid (face) - Click <a href="./Square/index.html">here</a>.</li>
</ul>
<p>For number of steps to terminal states, please refer to
<a href="./Simulation/index.html">simulation</a>.
</p>
</section>
<section id="refernces">
<h2>References and related pages</h2>
<p>D3.js - Data-Driven Document (<a href="http://d3js.org/">link</a>)</p>
<p>
Directed Graph Editor (<a href="http://bl.ocks.org/rkirsling/5001347">link</a>)
</p>
<p>
Vax | Gamifying Epidemic Prevention | Game (<a href="http://vax.herokuapp.com/">link</a>)
</p>
</section>
<br>
<section id="pageFooter">
<div id="contentCurve" style="border-bottom: 1px solid #ccc; font-size: 1px; height: 8px; margin-bottom: 8px;"></div>
<div id="copyright" style="margin-top: 20px; margin-bottom: 20px; color: gray;">
<span> Yibo Guo © 2014</span>
<a title="View on github" href="https://github.com/nilyibo/Percolation">Percolation Project</a>
</div>
</section>
</div>
</body>
<script src="./js/d3.v3.min.js"></script> <!-- d3 js library -->
<script src="./js/app.js"></script> <!-- Modified basic event handler -->
<script src="./js/infection.js"></script> <!-- functions used for infection model -->
<script type="text/javascript">
initSelectOnChange();
document.getElementById('files').addEventListener('change', handleFileSelect, false);
</script>
</html>