Skip to content

Instantly share code, notes, and snippets.

@dvas0004
Last active October 17, 2017 10:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvas0004/e6396cbba8d8a3cc606f46ebe230f61c to your computer and use it in GitHub Desktop.
Save dvas0004/e6396cbba8d8a3cc606f46ebe230f61c to your computer and use it in GitHub Desktop.
edges = [["192.168.1.1","1.1.1.1"],["192.168.2.1","2.2.2.2"], ...] //sample data - in reality you'd probably get this from an API
let id_counter = 0;
external_nodes.forEach(function(element){
const src = element[0];
const dst = element[1];
cytoscape_elements.push({
data: {
id: "edge_"+id_counter,
source: src,
target: dst
}
});
id_counter ++;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment