-
Notifications
You must be signed in to change notification settings - Fork 5
/
minSpanningTree.html
117 lines (95 loc) · 4.2 KB
/
minSpanningTree.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
<html>
<!-- THIS FILE WAS GENERATED BY A SCRIPT: DO NOT EDIT IT! -->
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="lib/bootstrap.min.css">
<link rel="stylesheet" href="userInterface.css">
<script src="lib/jquery.min.js"></script>
<script src="lib/bootstrap.min.js"></script>
<script src="lib/sigma/sigma.min.js"></script>
<script src="lib/sigma/sigma.renderers.canvas.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.labels.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.nodes.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.edges.def.js"></script>
<script src="lib/sigma/canvas/sigma.canvas.edges.arrow.js"></script>
<script src="lib/sigma/sigma.plugins.dragNodes.js"></script>
<script src="lib/sigma/sigma.canvas.labels.def.js"></script>
<script src="lib/sigma/sigma.canvas.edges.labels.def.js"></script>
<script src="lib/sigma/setting.js"></script>
<script src="lib/sigma/sigma.classes.graph.js"></script>
<script src="lib/sigma/graphArrange.js"></script>
<script src="lib/sigma/sigma.core.js"></script>
<script src="widgets.js"></script>
<script src="graph.js"></script>
<script src = "minSpanningTree.js"></script>
<link rel="stylesheet" href="style.css"> <!--algocynfas webpage css, independent from the user interface css -->
</head>
<body>
<h1> Find a Minimum Spanning Tree </h1>
<div class="container" style ="margin-left: 5em">
<b> Algorithms:
<input type="radio" name="algo" id="kruskal" checked = "true"/>
<label for="kruskal">Kruskal's Algorithm</label>
<input type="radio" name="algo" id="prims" />
<label for="prim">Prim's Algorithm</label>
<br>
</b>
<b>Choose Speed:
<input type="radio" name="speed" value="500" id="Fast"/>
<label for="Fast">Fast</label>
<input type="radio" name="speed" value="1000" id="Medium" checked="true"/>
<label for="Medium">Medium</label>
<input type="radio" name="speed" value="2000" id="Slow"/>
<label for="Slow">Slow</label>
<br>
</b>
<b>
Fill the input box with sample values:
</b>
<select id= spanningSample onchange="setSpanningSample()">
<option value="Select" >Select one</option>
<option value="sample1" >5 nodes with 8 edges </option>
<option value="sample2"> 10 nodes with 16 edges </option>
<option value="sample3"> Disconnected graph </option>
</select>
<br>
<br>
<input type="text" class="box" id="nodeNum"
placeholder="Enter node#, max 16 nodes">
<button class="btn btn-primary" id="add-node-button" type="button"
onclick="createGraph(false,'spanningGraphContainer')">Create Nodes
</button>
 
<br> <br>
<input type="text" class="edgeBox" id="edges"
placeholder="Enter edges (e.g: a-b, e-f-g)" >
 
<input type="text" class="weightBox" id="weights"
placeholder="Enter weights in the order of edges, e.g: 1,2"style = "display: inline" >
<button class="btn btn-primary" id="add-edge-button" type="button"
onclick="createGraph(true,'spanningGraphContainer')"> Create Edges
</button>
<br>
<br>
<button id = "run-button" type="button" class="btn btn-success col-1" onclick="run()">Run</button>
<button id = "stop-button" type="button" class="btn btn-danger col-1" onclick="stopAnime()">Stop</button>
<br>
<br>
<button id = "clear-button" type="button" class="btn btn-danger col-1"
style = "max-width: 150 ;width: 130" onclick="clearSpanningGraph()">Clear Graph</button>
<br>
<br>
<div id="spanningGraphContainer" class = "spanningGraphContainer" style = "width: 800px; height: 500px; border: 1px; border-style: solid"></div>
<footer id="minSpanLegend">
<script> window.display_legend("minSpanLegend", "Graph edge", "Minimum spanning tree path", '#0039e6', '#F5B041') </script>
</footer>
</div>
<script>
let inputType = "num"; //by giving number as node input
let dir = 0; //undirected
let weight = 1; //Weighted
let Graph = null;
let animeRunning = true;
</script>
</body>
</html>