-
Notifications
You must be signed in to change notification settings - Fork 0
/
dijkstra.html
188 lines (185 loc) · 9.52 KB
/
dijkstra.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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<!DOCTYPE html>
<html>
<head>
<title>Palgo</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/material-design/bootstrap-material-design.css">
<link rel="stylesheet" type="text/css" href="css/ripples/ripples.min.css">
<link rel="stylesheet" type="text/css" href="css/styles.css">
<link rel="stylesheet" type="text/css" href="css/vis/vis.css">
</head>
<body>
<div class="window">
<div class="bs-component">
<div class="navbar navbar-inverse">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse"
data-target=".navbar-inverse-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="welcome.html" class="navbar-left"><img src="assets/icons/png/icon.png" style="max-height: 60px;"></a>
</div>
<div class="navbar-collapse collapse navbar-inverse-collapse">
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="" data-target="#" class="dropdown-toggle" data-toggle="dropdown">Algorithms
<b class="caret"></b>
<div class="ripple-container"></div>
</a>
<ul class="dropdown-menu">
<li class="dropdown-header">Trees</li>
<li><a href="huffman.html">Huffman Tree</a></li>
<li><a href="prim-jarnik.html">Prim-Jarnik</a></li>
<li><a href="prim-jarnik-refinement.html">Prim-Jarnik Dijkstra's Refinement</a></li>
<li><a href="heap.html">Heap</a></li>
<li class="divider"></li>
<li class="dropdown-header">Graphs</li>
<li><a href="bfs.html">Breadth-First Search</a></li>
<li><a href="dfs.html">Depth-First Search</a></li>
<li class="active"><a href="dijkstra.html">Dijkstra's Shortest Path</a></li>
</ul>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<a href="mailto:[email protected]" class="btn btn-primary btn-fab"
data-toggle="tooltip" data-placement="left" title=""
data-original-title="Tooltip on left">
<i class="fa fa-comments-o"></i>
<div class="ripple-container"></div>
</a>
</li>
</ul>
</div>
</div>
</div>
<div id="source-button" class="btn btn-primary btn-xs" style="display: none;">< ></div>
</div>
<header class="toolbar toolbar-header">
<div class="row" style="margin-bottom: 16px; margin-left: 5px; margin-top: 15px;">
<a id="submit-btn" class="btn btn-primary btn-raised col-md-5">Start Algorithm
<div class="ripple-container"></div>
</a>
<a id="random-btn" class="btn btn-primary btn-raised col-md-4">Random
<div class="ripple-container"></div>
</a>
<div class="col-md-2 togglebutton" id="directedGraphOne">
<label>
<input type="checkbox" id="directed-checkbox" unchecked> Directed
</label>
</div>
</div>
</header>
<div class="window-content">
<div class="modal" id="edge-popUp">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" id="close-x" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title">Edge Weight</h4>
</div>
<div class="modal-body" id="edge-operation">
<div class="form-group label-floating" id="edge-label-text">
<label class="control-label" for="edge-label" >Add weight to the selected edge</label>
<input class="form-control" id="edge-label" type="text">
</div>
</div>
<div class="modal-footer">
<button type="button" value="save" class="btn btn-default" id="edge-cancelButton" data-dismiss="modal">Close</button>
<button type="button" value="cancel" class="btn btn-primary" id="edge-saveButton">Save changes</button>
</div>
</div>
</div>
</div>
<div class="modal" id="node-popUp">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" id="close-x1" data-dismiss="modal" aria-hidden="true">x</button>
<h4 class="modal-title">Edge Weight</h4>
</div>
<div class="modal-body" id="node-operation">
<div class="form-group label-floating" id="node-label-text">
<label class="control-label" for="node-label" id="n-label-text">Change node label</label>
<input class="form-control" id="node-label" type="text">
</div>
<div class="togglebutton">
<label>
<input type="checkbox" id="node-root-checkbox" unchecked> Mark node as root
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" value="save" class="btn btn-default" id="node-cancelButton" data-dismiss="modal">Close</button>
<button type="button" value="cancel" class="btn btn-primary" id="node-saveButton">Save changes</button>
</div>
</div>
</div>
</div>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">Dijkstra's Shortest Path</h3>
</div>
<div class="panel-body" id="algo-panel">
<div class="container-fluid">
<div class="row">
<div class="col-md-7">
<div id="tree-simple"></div>
</div>
<div class="col-md-5">
<div class="well well-lg">
<code id="function-call">Dijkstra's-Shortest-Path(Graph, root): </code><br>
<code id="line-0">     S = {u} </code><br>
<code id="line-1">     for (each vertex w) d(w) = wt(u, w) </code><br>
<code id="line-2">     while (S != V) { </code><br>
<code id="line-3">         find v not in S with d(v) minimum;</code><br>
<code id="line-4">         add v to S; </code><br>
<code id="line-5">         for (each w not in S) </code><br>
<code id="line-6">           d(w) = min {d(w), d(v) + wt(v, w)}; </code><br>
<code id="line-7">     } </code><br>
</div>
<table id="S" class='table table-hover'>
<caption> S </caption>
<tbody>
<tr id="s-line"></tr>
</tbody>
</table>
<table id="distances-table" class='table table-hover'>
<caption> Distances </caption>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
if (typeof module === 'object') {
window.module = module;
module = undefined;
}
</script>
<script src="js/jquery/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/ripples.min.js"></script>
<script src="js/material/material.js"></script>
<script>
$.material.init();
</script>
<script src="js/vis/vis.js"></script>
<script src="vendor/raphael.js"></script>
<script src="js/helpers/network-util.js"></script>
<script src="js/helpers/alerts.js"></script>
<script src="js/helpers/codeline-util.js"></script>
<script src="js/helpers/nodes-util.js"></script>
<script src="js/dijkstra/dijkstra.js"></script>
<script src="js/material/wNumb.js"></script>
</body>
</html>