* Write file with pagerank scores
*/
public void writeFileScores(Path inputSegments[], Path outputFile, final double scores[]) throws IOException {
final SequenceFile.Writer writer=SequenceFile.createWriter(fs, conf, outputFile, Text.class, FloatWritable.class, SequenceFile.CompressionType.BLOCK, new DefaultCodec());
final GraphManager graph = new GraphManager();
readLinks(inputSegments, new ReadLinksProcessor() {
public void run(String fromUrl, String toUrl) throws IOException { // read urls in the same order when it created the web graph, to write scores
int id;
if (!graph.hasId(fromUrl)) {
id=graph.getId(fromUrl);
writer.append(new Text(fromUrl), new FloatWritable( (float)scores[id] ));
}
if (!graph.hasId(toUrl)) {
id=graph.getId(toUrl);
writer.append(new Text(toUrl), new FloatWritable( (float)scores[id] ));
}
}
});