-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
default.html
87 lines (83 loc) · 2.82 KB
/
default.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
<!doctype html>
<html>
<head>
<title>Sample</title>
<style>
#app {
width: 600px;
height: 400px;
display: block;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="https://cdn.jsdelivr.net/npm/cytoscape"></script>
<script src="https://cdn.jsdelivr.net/npm/layout-base"></script>
<script src="https://cdn.jsdelivr.net/npm/avsdf-base"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-avsdf"></script>
<script src="https://cdn.jsdelivr.net/npm/cytoscape-layers"></script>
<script src="../build/index.umd.js"></script>
<script>
const cy = cytoscape({
container: document.getElementById('app'), // container to render in
layout: {
name: 'avsdf',
nodeSeparation: 120,
},
style: [
{
selector: 'node',
style: {
label: 'data(id)',
'text-valign': 'center',
color: '#000000',
'background-color': '#3a7ecf',
},
},
{
selector: 'edge',
style: {
width: 2,
'line-color': '#3a7ecf',
opacity: 0.5,
},
},
],
elements: {
nodes: [
{ data: { id: 'v1', weight: 1 } },
{ data: { id: 'v2', weight: 2 } },
{ data: { id: 'v3', weight: 3 } },
{ data: { id: 'v4', weight: 4 } },
{ data: { id: 'v5', weight: 5 } },
{ data: { id: 'v6', weight: 6 } },
{ data: { id: 'v7', weight: 7 } },
],
edges: [
{ data: { source: 'v1', target: 'v2', directed: 'false' } },
{ data: { source: 'v1', target: 'v4', directed: 'false' } },
{ data: { source: 'v1', target: 'v5', directed: 'false' } },
{ data: { source: 'v2', target: 'v4', directed: 'false' } },
{ data: { source: 'v2', target: 'v6', directed: 'false' } },
{ data: { source: 'v3', target: 'v4', directed: 'false' } },
{ data: { source: 'v3', target: 'v7', directed: 'false' } },
{ data: { source: 'v4', target: 'v5', directed: 'false' } },
{ data: { source: 'v4', target: 'v7', directed: 'false' } },
{ data: { source: 'v5', target: 'v6', directed: 'false' } },
{ data: { source: 'v6', target: 'v7', directed: 'false' } },
{ data: { source: 'v6', target: 'v3', directed: 'false' } },
],
},
});
cy.ready(() => {
const bb = cy.bubbleSets();
const edges = cy.edges().slice(0, 4);
const nodes = edges.connectedNodes();
bb.addPath(nodes, edges, cy.nodes().diff(nodes).left, {
drawPotentialArea: true,
});
});
</script>
</body>
</html>