| 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>() { |
| 113 | public Void apply(Transaction tr){ |
| 114 | ByteBuffer b = ByteBuffer.allocate(8); |
| 115 | b.order(ByteOrder.LITTLE_ENDIAN); |
| 116 | b.putLong(change); |
| 117 | tr.mutate(MutationType.ADD, wEdge.pack(Tuple.from(node,neighbor)), b.array()); |
| 118 | tr.mutate(MutationType.ADD, wInverse.pack(Tuple.from(neighbor,node)), b.array()); |
| 119 | return null; |
| 120 | } |
| 121 | }); |
| 122 | } |
| 123 | |
| 124 | public static long getWeight(TransactionContext tcx, final String node, final String neighbor){ |
| 125 | return tcx.run(new Function<Transaction,Long>() { |