This repository has been archived by the owner on May 29, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
133 lines (115 loc) · 4.7 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Projeto Grafos 😐</title>
<script src="graphs.js"></script>
<script src='dijkstra.js'></script>
<style type="text/css">
#filecontents {
border: double;
overflow-y: scroll;
width: 200px;
height: 100px;
}
</style>
</head>
<body>
Por favor selecione arquivo que será lido:
<input type="file" id="txtfiletoread" /><br />
<div>Conteúdo do arquivo:</div>
<div id="filecontents">
</div>
<script>
// var fileContents;
// window.onload = function () {
// if (window.File && window.FileReader && window.FileList && window.Blob) {
// let fileSelected = document.getElementById('txtfiletoread');
// fileSelected.addEventListener('change', function (e) {
//
// let fileExtension = /text.*/;
// let fileTobeRead = fileSelected.files[0];
// if (fileTobeRead.type.match(fileExtension)) {
// let fileReader = new FileReader();
//
// fileReader.onload = function (e) {
// fileContents = document.getElementById('filecontents');
// fileContents.innerText = fileReader.result;
// let data = fileContents.innerText;
//---------------leitura do arquivo-----------------------------------------------------------
// let data2 = data.split('\n');
//console.log(data2);
//-----------------------inicie funções aqui--------------------------------------------------
//------------------------lista adjecencia----------------------------------------------------
//
/*
let graph2 = new Graph(3);
graph2.addVertex(1);
graph2.addVertex(2);
graph2.addVertex(3);
graph2.addEdge(1,2,5);
graph2.addEdge(3,1,2);
console.log(graph2.toString());
*/
graph2 = new Graph(6);
myVertices = [0,1,2,3];
for (i=0; i<myVertices.length; i++){
graph2.addVertex(myVertices[i]);
}
graph2.addEdge(0, 1);
graph2.addEdge(0, 2);
graph2.addEdge(2,1);
graph2.addEdge(0, 3);
//var result2 = graph2.buscaProfundidade('C');
//var result3 = graph2.bfs('C');
//console.log(result3);
console.log(graph2.toString());
graph2.printSCCs();
//var result = graph2.ordenacaoTopologica();
//-------------------------bfs----------------------------------------------------------------
//var shortestPathA = graph2.bfs(String(8+"-"+8+":"+row[8][8]));
//console.log(shortestPathA)
// ;
/*
console.log('Dijkstra start > ');
graph3 = new Graph(6);
graph3.matAdj();
graph3.addAresta(0, 1, 2);
graph3.addAresta(0, 2, 4);
graph3.addAresta(1, 2, 1);
graph3.addAresta(1, 3, 4);
graph3.addAresta(1, 4, 2);
graph3.addAresta(2, 4, 3);
graph3.addAresta(3, 5, 2);
graph3.addAresta(4, 3, 3);
graph3.addAresta(4, 5, 2);
console.log(graph3.dijkstra(4));
console.log("PRIM");
graph4 = new Graph(4);
graph4.matAdj();
graph4.addAresta(0, 1, 10);
graph4.addAresta(0, 2, 6);
graph4.addAresta(0, 3, 5);
graph4.addAresta(1, 3, 15);
graph4.addAresta(2, 3, 4);
//graph4.prim();
graph4.kruskal();
*/
// }
// fileReader.readAsText(fileTobeRead);
// }
// else {
// alert("Por favor selecione arquivo texto");
// }
//
// }, false);
// }
// else {
// alert("Arquivo(s) não suportado(s)");
// }
// }
</script>
<div id ="content"></div>
</body>
</html>