14.5.5.1 Picking

This strategy can be used to pick an edge out of multi-edges. The graph server (PGX) allows the user to define several picking criteria. You can pick by:

  • Property
  • Label
  • Edge-ID

Every picking criteria has to be combined with a PickingStrategyFunction. PGX supports either PickingStrategyFunction.MIN and PickingStrategyFunction.MAX, which picks the edge whose property/label/id is either minimal or maximal. If one does not specify a picking criteria, PGX will non-deterministically pick an edge out of the multi-edges.

A PickingStrategy can be created using a PickingStrategyBuilder, which can be retrieved by calling createPickingStrategyBuilder() on the target graph.

You can call one of the following functions as per your chosen picking criteria:

PickingStrategyBuilder setPickByEdgeId(PickingStrategyFunction pickingStrategyFunction)
PickingStrategyBuilder setPickByLabel(PickingStrategyFunction pickingStrategyFunction)
PickingStrategyBuilder setPickByProperty(EdgeProperty edgeProperty, PickingStrategyFunction pickingStrategyFunction)
PickingStrategyBuilder setPickByProperty(String propertyName, PickingStrategyFunction pickingStrategyFunction)    

The following figure shows how PGX picks the edge with the minimal cost and takes all its properties.