-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
113 lines (113 loc) · 3.63 KB
/
index.html
File metadata and controls
113 lines (113 loc) · 3.63 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Generator drzew online - generator grafów online</title>
<meta name="author" content="marcel2012 @ GITHUB.COM">
<meta name="keywords" content="online,grafy,drzewa,algorytmy,algorytmika,dfs,bfs,drzewo,n,m,n-1">
<meta name="description" content="Generator drzew online. Generator grafów online. Euler. Hamilton. Przeszukiwanie w głąb.">
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
<link rel="icon" href="icon.png">
</head>
<body>
<div class="opcje">
<form style="float:left;" onsubmit="
if(document.getElementById('binarne').checked)
rysuj_drzewo(
drzewo(document.getElementById('n').value,
2),
true
);
else
rysuj_drzewo(
drzewo(document.getElementById('n').value,
document.getElementById('n').value),
true
);
return false;">
<table>
<tbody>
<tr>
<td>Ilość wierzchołków</td>
<td><input id="n" type="number" min="1" max="100" value="8"/></td>
</tr>
</tbody>
</table>
<label>
<input type="checkbox" id="binarne"/>
Binarne
</label>
<br>
<input type="submit" value="Generuj drzewo"/>
</form>
<form style="display:inline-block;" onsubmit="
if(document.getElementById('spojny').checked)
if(document.getElementById('graf_m').value<document.getElementById('graf_n').value-1)
{
alert('Niespełniony warunek m >= n-1');
return false;
}
if(document.getElementById('graf_m').value*2>document.getElementById('graf_n').value*(document.getElementById('graf_n').value-1))
{
alert('Niespełniony warunek m <= n*(n-1)/2');
return false;
}
do
{
poprawny=true;
wierzcholek=graf(document.getElementById('graf_n').value,
document.getElementById('graf_m').value);
if(document.getElementById('spojny').checked && !graf_spojny(wierzcholek))
poprawny=false;
}
while(!poprawny);
rysuj_graf(wierzcholek,true);
return false;">
<table>
<tbody>
<tr>
<td>Ilość wierzchołków</td>
<td><input id="graf_n" type="number" min="1" max="50" value="8"/></td>
</tr>
<tr>
<td>Ilość krewedzi</td>
<td><input id="graf_m" type="number" min="1" max="1225" value="16"/></td>
</tr>
</tbody>
</table>
<label>
<input type="checkbox" id="spojny" checked/>
Spójny
</label>
<br>
<input type="submit" value="Generuj graf"/>
</form>
</div>
<div class="dana">
<br>
<canvas id="canvas"></canvas>
<textarea id="dane">
</textarea>
<input id="copy1" onclick="document.getElementById('dane').select();document.execCommand('copy');return false;" type="submit" value="Skopiuj dane"/>
<input id="copy2" onclick="czytaj_graf(document.getElementById('dane').value);return false;" type="submit" value="Rysuj graf z danych"/>
<input id="copy3" onclick="czytaj_drzewo(document.getElementById('dane').value);return false;" type="submit" value="Rysuj drzewo z danych"/>
<div class="dane">
<h3>Drzewo</h3>
Dane:
n - liczba wierzchołków<br>
<br>
kolejne n-1 wierszy to informacje o rodzicach<br>
<br>
w i-tym wierszu znajduje się rodzic wierzchołka o numerze i <nobr>(numeracja wierzchołków od 0 do n-1)</nobr><br>
<br>
wierzchołek 0 jest korzeniem
<h3>Graf</h3>
Dane:
n,m - liczba wierzchołków, liczba krawędzi<br>
<br>
kolejne m wierszy to a,b między którymi istnieje krawędź
</div>
</div>
</body>
</html>