Menu

[r60]: / GraphScript / trunk / scripts / graphutil.js  Maximize  Restore  History

Download this file

37 lines (33 with data), 701 Bytes

 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
function vertices()
{
return Graph.getVertices().toArray();
}
function applyToVertices(func)
{
var vArray = vertices();
var c = Graph.numVertices();
for (var i = 0; i < c; i++)
{
func(vArray[i]);
}
}
function setVertexColor(vertex,color)
{
var vc = VC_BLACK;
switch (color.toLowerCase())
{
case 'red' : vc = VC_RED; break;
case 'white' : vc = VC_WHITE; break;
case 'grey' : vc = VC_GREY; break;
case 'blue' : vc = VC_BLUE; break;
}
GraphUI.setVertexColor(vertex,vc);
}
function setVertexLabel(vertex,label)
{
GraphUI.setVertexLabel(vertex,label || '');
}
function setVertexData(vertex,key,value)
{
Graph.setVertexData(vertex,key,value);
}
MongoDB Logo MongoDB