FileDataSource edges = new FileDataSource(new EdgeInputFormat(), edgeInput, "Input Edges");
edges.setParameter(EdgeInputFormat.ID_DELIMITER_CHAR, delimiter);
// =========================== 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();