function dealWithData() {
var NodeIdArray = [];
var RelationshipIdArray = [];
var nodeArray = [];
var relArray = []
for (let index = 0; index < all.length; index++) {
var sample = all[index]._fields[0]
var id = sample.identity.low
if (sample.constructor.name === "Node") {
if (!(NodeIdArray.includes(id))) {
NodeIdArray.push(id)
if (sample.labels[0] === "Restaurant") {
var res = sample.properties
res["ID"] = id
res["Label"] = sample.labels[0]
nodeArray.push(sample.properties)
} else {
var otherNode = sample.properties;
nodeArray.push({name:otherNode[Object.keys(otherNode)[0]], ID: id, Label:sample.labels[0]})
}
}
} else {
if (!(RelationshipIdArray.includes(id))) {
RelationshipIdArray.push(id)
var link = sample.properties
link.ID = sample.identity.low
link.source = sample.start.low
link.target = sample.end.low
link.value = 1
relArray.push(sample.properties)
}
}
}
function addRadius(d) {
d["radius"] = relArray.filter(a => a.source === d.ID || a.target === d.ID).length;
return d;
}
nodeArray.map(addRadius);
var finalArray = buildDataArray(nodeArray, relArray);
return finalArray
}