// =========================== Vertex Degree ============================
MapOperator projectEdge = MapOperator.builder(new ProjectEdge())
.input(edges).name("Project Edge").build();
ReduceOperator edgeCounter = ReduceOperator.builder(new CountEdges(), IntValue.class, 0)
.input(projectEdge).name("Count Edges for Vertex").build();
ReduceOperator countJoiner = ReduceOperator.builder(new JoinCountsAndUniquify(), IntValue.class, 0)
.keyField(IntValue.class, 1)
.input(edgeCounter).name("Join Counts").build();
// =========================== Triangle Enumeration ============================
MapOperator toLowerDegreeEdge = MapOperator.builder(new ProjectToLowerDegreeVertex())
.input(countJoiner).name("Select lower-degree Edge").build();
MapOperator projectOutCounts = MapOperator.builder(new ProjectOutCounts())
.input(countJoiner).name("Project out Counts").build();
ReduceOperator buildTriads = ReduceOperator.builder(new BuildTriads(), IntValue.class, 0)
.input(toLowerDegreeEdge).name("Build Triads").build();
JoinOperator closeTriads = JoinOperator.builder(new CloseTriads(), IntValue.class, 1, 0)
.keyField(IntValue.class, 2, 1)
.input1(buildTriads).input2(projectOutCounts)