@NotThreadSafe public class LongDiffNullArrayEdges extends ConfigurableOutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable> implements ReuseObjectsOutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>, MutableOutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>, Trimmable
OutEdges
with long ids
and null edge values, backed by a dynamic primitive array.
Parallel edges are allowed.
Note: this implementation is optimized for space usage,
but random access and edge removals are expensive.
Users of this class should explicitly call trim()
function
to compact in-memory representation after all updates are done.
Compacting object is expensive so should only be done once after bulk update.
Compaction can also be caused by serialization attempt or
by calling iterator()
Constructor and Description |
---|
LongDiffNullArrayEdges() |
Modifier and Type | Method and Description |
---|---|
void |
add(Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable> edge)
Add an edge.
|
void |
initialize()
Initialize the data structure with the default initial capacity.
|
void |
initialize(int capacity)
Initialize the data structure with the specified initial capacity.
|
void |
initialize(Iterable<Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> edgeIterator)
Initialize the data structure and set the edges from an iterable.
|
Iterator<Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> |
iterator() |
Iterator<MutableEdge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> |
mutableIterator()
Returns an iterator over edges that can be modified in-place,
either by changing the current edge value or by removing the current edge.
|
void |
readFields(DataInput in) |
void |
remove(org.apache.hadoop.io.LongWritable targetVertexId)
Remove all edges to the given target vertex.
|
void |
setConf(ImmutableClassesGiraphConfiguration<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Writable,org.apache.hadoop.io.NullWritable> conf)
Set the configuration to be used by this object.
|
int |
size()
Return the number of edges.
|
void |
trim()
This function takes all recent updates and stores them efficiently.
|
void |
write(DataOutput out) |
getConf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public void setConf(ImmutableClassesGiraphConfiguration<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Writable,org.apache.hadoop.io.NullWritable> conf)
GiraphConfigurationSettable
setConf
in interface GiraphConfigurationSettable<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Writable,org.apache.hadoop.io.NullWritable>
setConf
in class DefaultImmutableClassesGiraphConfigurable<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.Writable,org.apache.hadoop.io.NullWritable>
conf
- Set configurationpublic void initialize(Iterable<Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> edgeIterator)
OutEdges
initialize
in interface OutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>
edgeIterator
- Iterable of edgespublic void initialize(int capacity)
OutEdges
initialize
in interface OutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>
capacity
- Initial capacitypublic void initialize()
OutEdges
initialize
in interface OutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>
public void add(Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable> edge)
OutEdges
public void remove(org.apache.hadoop.io.LongWritable targetVertexId)
OutEdges
public int size()
OutEdges
public Iterator<Edge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> iterator()
public Iterator<MutableEdge<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>> mutableIterator()
MutableOutEdges
mutableIterator
in interface MutableOutEdges<org.apache.hadoop.io.LongWritable,org.apache.hadoop.io.NullWritable>
public void write(DataOutput out) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput in) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
Copyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.