I
- Vertex idE
- Edge valuepublic class HashMultimapEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable> extends ConfigurableOutEdges<I,E> implements MultiRandomAccessOutEdges<I,E>, Trimmable
OutEdges
implementation backed by an ArrayListMultimap
.
Parallel edges are allowed.
Note: this implementation is optimized for fast mutations,
but uses more space.Constructor and Description |
---|
HashMultimapEdges() |
Modifier and Type | Method and Description |
---|---|
void |
add(Edge<I,E> edge)
Add an edge.
|
Iterable<E> |
getAllEdgeValues(I targetVertexId)
Return an iterable over the edge values for a given target vertex id.
|
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(int expectedNeighbors,
int expectedEdgesPerNeighbor)
Additional initialization method tailored to the underlying multimap
implementation.
|
void |
initialize(Iterable<Edge<I,E>> edges)
Initialize the data structure and set the edges from an iterable.
|
Iterator<Edge<I,E>> |
iterator() |
void |
readFields(DataInput in) |
void |
remove(I targetVertexId)
Remove all edges to the given target vertex.
|
int |
size()
Return the number of edges.
|
void |
trim()
Compacts all recent updates to this object.
|
void |
write(DataOutput out) |
getConf, setConf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public void initialize(Iterable<Edge<I,E>> edges)
OutEdges
initialize
in interface OutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
edges
- Iterable of edgespublic void initialize(int expectedNeighbors, int expectedEdgesPerNeighbor)
expectedNeighbors
- Expected number of unique neighborsexpectedEdgesPerNeighbor
- Expected number of edges per neighborpublic void initialize(int capacity)
OutEdges
initialize
in interface OutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
capacity
- Initial capacitypublic void initialize()
OutEdges
initialize
in interface OutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
public void add(Edge<I,E> edge)
OutEdges
public void remove(I targetVertexId)
OutEdges
public Iterable<E> getAllEdgeValues(I targetVertexId)
MultiRandomAccessOutEdges
getAllEdgeValues
in interface MultiRandomAccessOutEdges<I extends org.apache.hadoop.io.WritableComparable,E extends org.apache.hadoop.io.Writable>
targetVertexId
- Target vertex idpublic int size()
OutEdges
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.