Skip to content

Instantly share code, notes, and snippets.

@timknip
Created May 18, 2012 12:10
Show Gist options
  • Save timknip/2724963 to your computer and use it in GitHub Desktop.
Save timknip/2724963 to your computer and use it in GitHub Desktop.
clone graph
var G = new networkx.Graph();
var tmp = new Map();
forEach (graph.getNodes(), function(n) {
tmp.set(n, new Point2(n.x, n.y));
});
forEach (graph.getEdges(), function(e) {
G.addEdge(tmp.get(e[0]), tmp.get(e[1]));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment