-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
71 lines (62 loc) · 2.72 KB
/
Copy pathindex.html
File metadata and controls
71 lines (62 loc) · 2.72 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Graph Visualizer</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>🌐 Interactive Graph Visualizer</h1>
<div class="main-grid">
<div class="input-panel">
<div class="form-group">
<label for="vertices">Number of Vertices:</label>
<input type="number" id="vertices" min="1" max="50" value="5" placeholder="Enter number of vertices">
</div>
<div class="form-group">
<label for="input-type">Input Format:</label>
<select id="input-type">
<option value="adjacency">Adjacency List</option>
<option value="edge">Edge List</option>
</select>
</div>
<div class="input-format" id="format-help">
<div class="format-title">Adjacency List Format:</div>
<div>Each line: vertex: neighbor1,neighbor2,...</div>
<div class="format-example">0: 1,2<br>1: 0,3<br>2: 0,3<br>3: 1,2</div>
</div>
<div class="form-group">
<label for="graph-input">Graph Input:</label>
<textarea id="graph-input" placeholder="Enter your graph data here...">0: 1,2
1: 0,3
2: 0,3
3: 1,2</textarea>
<div class="help-text">Enter graph data according to the selected format</div>
</div>
<div class="form-group">
<label>
<input type="checkbox" id="directed" style="width: auto; margin-right: 8px;">
Directed Graph
</label>
</div>
<button onclick="visualizeGraph()">🎨 Visualize Graph</button>
<button onclick="generateRandom()" class="clear-btn">🎲 Generate Random</button>
<button onclick="clearCanvas()" class="clear-btn">🗑️ Clear Canvas</button>
<div id="error-message"></div>
</div>
<div class="canvas-container">
<canvas id="canvas" width="800" height="600"></canvas>
<div class="info-panel">
<div><strong>Controls:</strong></div>
<div>• Drag to pan</div>
<div>• Mouse wheel to zoom</div>
<div>• Click vertices to highlight</div>
</div>
</div>
</div>
</div>
<script src="script.js"></script>
</body>
</html>