MCPcopy Create free account
hub / github.com/apple/foundationdb / setEdgeWeighted

Method setEdgeWeighted

recipes/java-recipes/MicroGraph.java:98–109  ·  view source on GitHub ↗
(TransactionContext tcx, final String node, final String neighbor, final long weight)

Source from the content-addressed store, hash-verified

96 // in the extensions of graph, namely code to handle weighted graphs.
97 // The third is not mentioned but is a necessary add on to read weights.
98 public static void setEdgeWeighted(TransactionContext tcx, final String node, final String neighbor, final long weight){
99 tcx.run(new Function<Transaction,Void>(){
100 public Void apply(Transaction tr){
101 ByteBuffer b = ByteBuffer.allocate(8);
102 b.order(ByteOrder.LITTLE_ENDIAN);
103 b.putLong(weight);
104 tr.set(wEdge.pack(Tuple.from(node,neighbor)), b.array());
105 tr.set(wInverse.pack(Tuple.from(neighbor,node)), b.array());
106 return null;
107 }
108 });
109 }
110
111 public static void updateEdgeWeight(TransactionContext tcx, final String node, final String neighbor, final long change){
112 tcx.run(new Function<Transaction,Void>() {

Callers 1

smokeTestMethod · 0.95

Calls 1

runMethod · 0.65

Tested by

no test coverage detected