@Override public void map( final NullWritable key, final FaunusElement value, final Mapper<NullWritable, FaunusElement, LongWritable, FaunusVertex>.Context context) throws IOException, InterruptedException { if (value instanceof FaunusEdge) { final long outId = ((FaunusEdge) value).getVertexId(OUT); final long inId = ((FaunusEdge) value).getVertexId(IN); FaunusVertex vertex = this.map.get(outId); if (null == vertex) { vertex = new FaunusVertex(outId); this.map.put(outId, vertex); } vertex.addEdge(OUT, (FaunusEdge) value); this.counter++; vertex = this.map.get(inId); if (null == vertex) { vertex = new FaunusVertex(inId); this.map.put(inId, vertex); } vertex.addEdge(IN, (FaunusEdge) value); context.getCounter(Counters.EDGES_PROCESSED).increment(1l); this.counter++; } else { final long id = value.getIdAsLong(); FaunusVertex vertex = this.map.get(id); if (null == vertex) { vertex = new FaunusVertex(id); this.map.put(id, vertex); } vertex.getProperties().putAll(value.getProperties()); vertex.addEdges(BOTH, (FaunusVertex) value); this.counter++; } if (this.counter > MAX_MAP_SIZE) this.flush(context); }