Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.FloatWritable$Comparator


      getValue().set((0.15f / getTotalNumVertices()) + 0.85f * sum);
    }

    if (getSuperstep() < getConf().getInt(SUPERSTEP_COUNT, 0)) {
      sendMessageToAllEdges(
          new FloatWritable(getValue().get() / getNumEdges()));
    } else {
      voteToHalt();
    }
  }
View Full Code Here


        Math.max(getAggregatedValue().get(), value.get()));
  }

  @Override
  public FloatWritable createInitialValue() {
    return new FloatWritable(Float.MIN_VALUE);
  }
View Full Code Here

      LongWritable vertexIndex =
          new LongWritable(rangeVertexIdStart(3) + getId().get());
      addVertexRequest(vertexIndex, new DoubleWritable(0.0));
      // Add edges to those remote vertices as well
      addEdgeRequest(vertexIndex,
          EdgeFactory.create(getId(), new FloatWritable(0.0f)));
    } else if (getSuperstep() == 4) {
      LOG.debug("Reached superstep " + getSuperstep());
    } else if (getSuperstep() == 5) {
      long vertexCount = workerContext.getVertexCount();
      if (vertexCount * 2 != getTotalNumVertices()) {
View Full Code Here

        LOG.debug("compute: vertex " + getId() +
            " has value " + getValue() +
            " on superstep " + getSuperstep());
      }
      for (Edge<LongWritable, FloatWritable> edge : getEdges()) {
        FloatWritable newEdgeValue = new FloatWritable(
            edge.getValue().get() + (float) vertexValue);
        Edge<LongWritable, FloatWritable> newEdge =
            EdgeFactory.create(edge.getTargetVertexId(), newEdgeValue);
        if (LOG.isDebugEnabled()) {
          LOG.debug("compute: vertex " + getId() +
              " sending edgeValue " + edge.getValue() +
              " vertexValue " + vertexValue +
              " total " + newEdgeValue +
              " to vertex " + edge.getTargetVertexId() +
              " on superstep " + getSuperstep());
        }
        addEdge(newEdge);
        sendMessage(edge.getTargetVertexId(),
            new VerifiableMessage(
                getSuperstep(), getId().get(), newEdgeValue.get()));
      }
    }
View Full Code Here

      long targetVertexId =
          (vertexId.get() + 1) %
          (inputSplit.getNumSplits() * totalRecords);
      float edgeValue = vertexId.get() * 100f;
      edges.add(EdgeFactory.create(new LongWritable(targetVertexId),
          new FloatWritable(edgeValue)));
      vertex.initialize(vertexId, vertexValue, edges);
      ++recordsRead;
      if (LOG.isInfoEnabled()) {
        LOG.info("next: Return vertexId=" + vertex.getId().get() +
            ", vertexValue=" + vertex.getValue() +
View Full Code Here

        new LongWritable(7L), new DoubleWritable(Double.MAX_VALUE), false);

    Mockito.when(SOURCE_ID.get(env.getConfiguration())).thenReturn(2L);

    vertex.addEdge(EdgeFactory.create(
        new LongWritable(10L), new FloatWritable(2.5f)));
    vertex.addEdge(EdgeFactory.create(
        new LongWritable(20L), new FloatWritable(0.5f)));

    vertex.compute(Lists.newArrayList(new DoubleWritable(2),
        new DoubleWritable(1.5)));

    assertTrue(vertex.isHalted());
View Full Code Here

        new LongWritable(7L), new DoubleWritable(0.5), false);

    Mockito.when(SOURCE_ID.get(env.getConfiguration())).thenReturn(2L);

    vertex.addEdge(EdgeFactory.create(new LongWritable(10L),
        new FloatWritable(2.5f)));
    vertex.addEdge(EdgeFactory.create(
        new LongWritable(20L), new FloatWritable(0.5f)));

    vertex.compute(Lists.newArrayList(new DoubleWritable(2),
        new DoubleWritable(1.5)));

    assertTrue(vertex.isHalted());
View Full Code Here

          (vertexId.get() + 1) %
          (inputSplit.getNumSplits() * totalRecords);
      float edgeValue = vertexId.get() * 100f;
      List<Edge<LongWritable, FloatWritable>> edges = Lists.newLinkedList();
      edges.add(EdgeFactory.create(new LongWritable(targetVertexId),
          new FloatWritable(edgeValue)));
      vertex.initialize(vertexId, vertexValue, edges);
      ++recordsRead;
      if (LOG.isInfoEnabled()) {
        LOG.info("next: Return vertexId=" + vertex.getId().get() +
            ", vertexValue=" + vertex.getValue() +
View Full Code Here

        new ArrayListEdges<IntWritable, DoubleWritable>();
    edges.initialize(3);
    edges.add(EdgeFactory.create(new IntWritable(2), new DoubleWritable(22)));
    edges.add(EdgeFactory.create(new IntWritable(3), new DoubleWritable(33)));
    edges.add(EdgeFactory.create(new IntWritable(4), new DoubleWritable(44)));
    vertex.initialize(new IntWritable(1), new FloatWritable(1), edges);
    GiraphTransferRegulator gtr =
        new GiraphTransferRegulator(job.getConfiguration());
    PartitionOwner owner = mock(PartitionOwner.class);
    when(owner.getPartitionId()).thenReturn(57);
    assertFalse(gtr.transferThisPartition(owner));
View Full Code Here

public class TestFloatAggregators {

  @Test
  public void testMaxAggregator() {
    FloatMaxAggregator max = new FloatMaxAggregator();
    max.aggregate(new FloatWritable(2.0f));
    max.aggregate(new FloatWritable(3.0f));
    assertEquals(3.0f, max.getAggregatedValue().get(), 0f);
    max.setAggregatedValue(new FloatWritable(1.0f));
    assertEquals(1.0f, max.getAggregatedValue().get(), 0f);
    FloatWritable fw = max.createInitialValue();
    assertNotNull(fw);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.FloatWritable$Comparator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.