Light High Efficiency Graph Component
en

Qunee Developer Guide

Element Management

Element management is the basic function of graph model. The graph model has functions of Array and Map. The internal manages the elements via array and ID mapping table. Adding and removal of elements, sequence modification and acquire traversal operation

Adds or remove

Other collection operation function

#indexOf(data) - acquire array position of elements

#setIndex(data, index) - set the array position of elements

#size() - collection size

#length - collection size

#forEach(call, scope, params) - traverse according to array collection

#forEachReverse(call, scope, params) - traverse reversely by array collection

Example

Adds elements in graph model, and traverse the model reversely

var model = new Q.GraphModel();
model.add(new Q.Node('A'));
model.add(new Q.Node('B'));
model.add(new Q.Node('C'));
Q.log('model size: ' + model.length);
model.forEachReverse(function(node){
    Q.log(node.name);
});
Q.log('the first node is: ' + model.get(0).name);

Print results

model size: 3
C
B
A