Skip to content

Commit 3698357

Browse files
committed
removed prototype from iterator constructor
1 parent e84ec22 commit 3698357

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/it/unimi/dsi/webgraph/labelling/ScatteredLabelledArcsASCIIGraph.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -655,17 +655,17 @@ public ScatteredLabelledArcsASCIIGraph(final Iterator<long[]> arcs, final Long2I
655655

656656
int j;
657657
int[] source = new int[batchSize], target = new int[batchSize];
658-
long[] labelStart = new long[batchSize];
658+
long[] start = new long[batchSize];
659659
FastByteArrayOutputStream fbos = new FastByteArrayOutputStream();
660660
OutputBitStream obs = new OutputBitStream(fbos);
661-
Label prototype = null;
662661
final ObjectArrayList<File> batches = new ObjectArrayList<>(), labelBatches = new ObjectArrayList<>();
663662

664663
if (pl != null) {
665664
pl.itemsName = "labelled arcs";
666665
pl.start("Creating sorted batches...");
667666
}
668667

668+
Label l = null;
669669
j = 0;
670670
long pairs = 0; // Number of pairs
671671
while (arcs.hasNext()) {
@@ -681,19 +681,18 @@ public ScatteredLabelledArcsASCIIGraph(final Iterator<long[]> arcs, final Long2I
681681
throw new IllegalArgumentException("Not enough labels");
682682
}
683683

684-
Label l = arcLabels.next();
685-
prototype = prototype == null ? l : prototype;
684+
l = arcLabels.next();
686685

687686
if (s != t || !noLoops) {
688687
source[j] = s;
689688
target[j] = t;
690-
labelStart[j] = obs.writtenBits();
689+
start[j] = obs.writtenBits();
691690
l.toBitStream(obs, s);
692691
j++;
693692

694693
if (j == batchSize) {
695694
obs.flush();
696-
pairs += processTransposeBatch(batchSize, source, target, labelStart, new InputBitStream(fbos.array), tempDir, batches, labelBatches, prototype, labelMergeStrategy);
695+
pairs += processTransposeBatch(batchSize, source, target, start, new InputBitStream(fbos.array), tempDir, batches, labelBatches, l, labelMergeStrategy);
697696
fbos = new FastByteArrayOutputStream();
698697
obs = new OutputBitStream(fbos);
699698
j = 0;
@@ -702,13 +701,13 @@ public ScatteredLabelledArcsASCIIGraph(final Iterator<long[]> arcs, final Long2I
702701
if (symmetrize && s != t) {
703702
source[j] = t;
704703
target[j] = s;
705-
labelStart[j] = obs.writtenBits();
704+
start[j] = obs.writtenBits();
706705
l.toBitStream(obs, t);
707706
j++;
708707

709708
if (j == batchSize) {
710709
obs.flush();
711-
pairs += processTransposeBatch(batchSize, source, target, labelStart, new InputBitStream(fbos.array), tempDir, batches, labelBatches, prototype, labelMergeStrategy);
710+
pairs += processTransposeBatch(batchSize, source, target, start, new InputBitStream(fbos.array), tempDir, batches, labelBatches, l, labelMergeStrategy);
712711
fbos = new FastByteArrayOutputStream();
713712
obs = new OutputBitStream(fbos);
714713
j = 0;
@@ -725,7 +724,7 @@ public ScatteredLabelledArcsASCIIGraph(final Iterator<long[]> arcs, final Long2I
725724

726725
if (j != 0) {
727726
obs.flush();
728-
pairs += processTransposeBatch(j, source, target, labelStart, new InputBitStream(fbos.array), tempDir, batches, labelBatches, prototype, labelMergeStrategy);
727+
pairs += processTransposeBatch(j, source, target, start, new InputBitStream(fbos.array), tempDir, batches, labelBatches, l, labelMergeStrategy);
729728
}
730729

731730
if (pl != null) {
@@ -736,13 +735,13 @@ public ScatteredLabelledArcsASCIIGraph(final Iterator<long[]> arcs, final Long2I
736735
numNodes = function == null ? (int)map.size() : function.size();
737736
source = null;
738737
target = null;
739-
labelStart = null;
738+
start = null;
740739

741740
if (function == null) {
742741
ids = map.getIds(tempDir);
743742
}
744743

745-
this.arcLabelledBatchGraph = new Transform.ArcLabelledBatchGraph(function == null ? numNodes : n, pairs, batches, labelBatches, prototype, labelMergeStrategy);
744+
this.arcLabelledBatchGraph = new Transform.ArcLabelledBatchGraph(function == null ? numNodes : n, pairs, batches, labelBatches, l, labelMergeStrategy);
746745
}
747746

748747
protected static void logBatches(final ObjectArrayList<File> batches, final long pairs, final ProgressLogger pl) {

0 commit comments

Comments
 (0)