コード例 #1
0
 @Override
 protected void map(UndirectedEdgeWithDegrees edgeWithDegrees, Object value, Context ctx)
     throws IOException, InterruptedException {
   Vertex firstVertex = edgeWithDegrees.getFirstVertexWithDegree().getVertex();
   Vertex secondVertex = edgeWithDegrees.getSecondVertexWithDegree().getVertex();
   ctx.write(new JoinableUndirectedEdge(firstVertex, secondVertex, true), VertexOrMarker.MARKER);
 }
コード例 #2
0
    @Override
    protected void map(UndirectedEdgeWithDegrees edge, Object value, Context ctx)
        throws IOException, InterruptedException {
      VertexWithDegree first = edge.getFirstVertexWithDegree();
      VertexWithDegree second = edge.getSecondVertexWithDegree();

      if (first.getDegree() < second.getDegree()) {
        ctx.write(first.getVertex(), second.getVertex());
      } else {
        ctx.write(second.getVertex(), first.getVertex());
      }
    }