public static void main(String[] args) throws Exception { if(!parseParameters(args)) { return; } StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); SimpleEdgeStream<Long, NullValue> edges = getGraphStream(env); DataStream<Tuple2<Integer, Long>> triangleCount = edges.slice(windowTime, EdgeDirection.ALL) .applyOnNeighbors(new GenerateCandidateEdges()) .keyBy(0, 1).timeWindow(windowTime) .apply(new CountTriangles()) .timeWindowAll(windowTime).sum(0); if (fileOutput) { triangleCount.writeAsText(outputPath); } else { triangleCount.print(); } env.execute("Naive window triangle count"); }