/** * Calculates the average outgoing degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average outgoing degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new OutgoingVertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_OUTGOING_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); }
/** * Calculates the average degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new VertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); } }
/** * Calculates the average incoming degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average incoming degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new IncomingVertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_INCOMING_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); } }
/** * Calculates the average incoming degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average incoming degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new IncomingVertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_INCOMING_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); }
/** * Calculates the average degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new VertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); }
/** * Calculates the average outgoing degree of the input graph and writes it to the graph head. * * @param graph the input graph * @return LogicalGraph with the average outgoing degree value written to the graph head. */ @Override public LogicalGraph execute(LogicalGraph graph) { graph = graph.aggregate(new VertexCount()); DataSet<GraphHead> newGraphHead = new OutgoingVertexDegrees().execute(graph) .sum(1) .crossWithTiny(graph.getGraphHead().first(1)) .with(new AddSumDegreesToGraphHeadCrossFunction( SamplingEvaluationConstants.PROPERTY_KEY_SUM_DEGREES)) .map(new CalculateAverageDegree( SamplingEvaluationConstants.PROPERTY_KEY_AVERAGE_OUTGOING_DEGREE)); return graph.getConfig().getLogicalGraphFactory() .fromDataSets(newGraphHead, graph.getVertices(), graph.getEdges()); } }