forked from d3/d3-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (31 loc) · 779 Bytes
/
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
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script src="graph.js"></script>
<script>
var g = d3.graph();
g.nodes(['red', 'purple', 'orange']);
g.matrix([
[0,1,0],
[1,0,0],
[1,1,1]
]);
console.log('matrix to list', d3.graph.matrixToList([
[0,1,0],
[1,0,0],
[1,1,1]
]));
console.log('list to matrix', d3.graph.listToMatrix([
{"source":0,"target":1,"value":1},
{"source":1,"target":0,"value":1},
{"source":2,"target":0,"value":1},
{"source":2,"target":1,"value":1},
{"source":2,"target":2,"value":1}
]));
console.log('nodes', g.nodes() );
console.log('links', g.links() );
console.log('matrix', g.matrix() );
var m = d3.graph.matrix([
[1,1,0],
[0,0,0],
[2,1,1]
]);
</script>