Skip to content

Instantly share code, notes, and snippets.

@karussell
Last active August 20, 2018 10:51
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 karussell/f4c2b2b1191be978d7ee9ec8dd2cd48f to your computer and use it in GitHub Desktop.
Save karussell/f4c2b2b1191be978d7ee9ec8dd2cd48f to your computer and use it in GitHub Desktop.
// New EdgeIteratorState setter API, without exposing IntsRef and without public getFlags/getData(int)
encDistance = encodingManager.get("distance");
encSpeed = encodingManager.get("car.average_speed");
encMaxSpeed = encodingManager.get("car.max_speed");
// improved usage to store values easy and more efficient
EdgeIteratorState edge = graph.newEdge().setNodes(from, to); // creates tempary memory to store attributes, we could easily use the implementation for VirtualEdgeIteratorState
edge.set(encDistance, 123.5).set(encSpeed, 20).set(encMaxSpeed, 50);
// for EdgeIterator we could also implement kind of autocommit when next() is called
edge.store(); // create edgeId and copies attributes into DataAccess (best via sys copy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment