Similar to mapVertices and mapEdges, mapTriplets is used to transform edge triplets. The following is the signature of the method:
mapTriplets(scala.Function1<EdgeTriplet<VD,ED>,ED2> map, scala.reflect.ClassTag<ED2> evidence$6)
Here, we will perform the same operation as we executed in the mapEdges section; that is, transform the edge property to integer value. The following is the definition of the transformation function:
public class AbsFunc1 extends AbstractFunction1<EdgeTriplet<string,string>,Integer> implements Serializable { @Override public Integer apply(EdgeTriplet<string,string> triplet) { return triplet.attr().length(); } }
The mapTriplets transformation can be executed as follows:
graph.mapTriplets(new AbsFunc1(), scala.reflect.ClassTag$.MODULE$.apply(Integer.class));