public Float getFloat(String key, Float defaultValue) { return giraphConfiguration.getFloat(key, defaultValue); }
/** * Constructor. * * @param numVertices Total number of vertices. * @param conf Configuration. */ public PseudoRandomIntNullLocalEdgesHelper(int numVertices, ImmutableClassesGiraphConfiguration conf) { this.minLocalEdgesRatio = conf.getFloat( PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO, PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO_DEFAULT); this.numVertices = numVertices; int numWorkers = conf.getMaxWorkers(); List<WorkerInfo> workerInfos = Collections.nCopies(numWorkers, new WorkerInfo()); numPartitions = PartitionUtils.computePartitionCount( workerInfos.size(), conf); partitionSize = numVertices / numPartitions; }
PseudoRandomInputFormatConstants.EDGES_PER_VERTEX + " <= 0"); float minLocalEdgesRatio = getConf().getFloat( PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO, PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO_DEFAULT);
PseudoRandomInputFormatConstants.EDGES_PER_VERTEX + " <= 0"); float minLocalEdgesRatio = getConf().getFloat( PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO, PseudoRandomInputFormatConstants.LOCAL_EDGES_MIN_RATIO_DEFAULT);
@Override public void initialize(InputSplit inputSplit, TaskAttemptContext context) throws IOException { trustProb = getConf().getFloat( TRUST_PROBABILITY, TRUST_PROBABILITY_DEFAULT); beta = getConf().getFloat( BETA, 0.0f); aggregateVertices = getConf().getLong( AGGREGATE_VERTICES, 0); BspInputSplit bspInputSplit = (BspInputSplit) inputSplit; long extraVertices = aggregateVertices % bspInputSplit.getNumSplits(); totalSplitVertices = aggregateVertices / bspInputSplit.getNumSplits(); if (bspInputSplit.getSplitIndex() < extraVertices) { ++totalSplitVertices; } startingVertexId = bspInputSplit.getSplitIndex() * (aggregateVertices / bspInputSplit.getNumSplits()) + Math.min(bspInputSplit.getSplitIndex(), extraVertices); edgesPerVertex = getConf().getInt( EDGES_PER_VERTEX, 0); if (getConf().reuseEdgeObjects()) { reusableEdge = getConf().createReusableEdge(); } int seed = getConf().getInt(SEED, -1); if (seed != -1) { rnd = new Random(seed); } else { rnd = new Random(); } }
@Override public void initialize(InputSplit inputSplit, TaskAttemptContext context) throws IOException { beta = getConf().getFloat( BETA, 0.0f); aggregateVertices = getConf().getLong( AGGREGATE_VERTICES, 0); BspInputSplit bspInputSplit = (BspInputSplit) inputSplit; long extraVertices = aggregateVertices % bspInputSplit.getNumSplits(); totalSplitVertices = aggregateVertices / bspInputSplit.getNumSplits(); if (bspInputSplit.getSplitIndex() < extraVertices) { ++totalSplitVertices; } startingVertexId = bspInputSplit.getSplitIndex() * (aggregateVertices / bspInputSplit.getNumSplits()) + Math.min(bspInputSplit.getSplitIndex(), extraVertices); edgesPerVertex = getConf().getInt( EDGES_PER_VERTEX, 0); if (getConf().reuseEdgeObjects()) { reusableEdge = getConf().createReusableEdge(); } int seed = getConf().getInt(SEED, -1); if (seed != -1) { rnd = new Random(seed); } else { rnd = new Random(); } }
vertex.setValue(value); float fraction = getConf().getFloat( SOURCES_FRACTION, SOURCES_FRACTION_DEFAULT); if (fraction>0) {