Class VertexImpl<VID_T,OID_T extends org.apache.hadoop.io.WritableComparable,VDATA_T extends org.apache.hadoop.io.Writable,EDATA_T extends org.apache.hadoop.io.Writable>
- java.lang.Object
-
- org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable<OID_T,VDATA_T,EDATA_T>
-
- com.alibaba.graphscope.graph.impl.VertexImpl<VID_T,OID_T,VDATA_T,EDATA_T>
-
- All Implemented Interfaces:
org.apache.giraph.conf.GiraphConfigurationSettable<OID_T,VDATA_T,EDATA_T>,org.apache.giraph.conf.ImmutableClassesGiraphConfigurable<OID_T,VDATA_T,EDATA_T>,org.apache.giraph.graph.Vertex<OID_T,VDATA_T,EDATA_T>
public class VertexImpl<VID_T,OID_T extends org.apache.hadoop.io.WritableComparable,VDATA_T extends org.apache.hadoop.io.Writable,EDATA_T extends org.apache.hadoop.io.Writable> extends org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable<OID_T,VDATA_T,EDATA_T> implements org.apache.giraph.graph.Vertex<OID_T,VDATA_T,EDATA_T>
-
-
Constructor Summary
Constructors Constructor Description VertexImpl()Usually the default constructor is only used when we load vertex with vif.VertexImpl(GiraphComputationAdaptorContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(org.apache.giraph.edge.Edge<OID_T,EDATA_T> edge)Add an edge for this vertex (happens immediately)Iterable<EDATA_T>getAllEdgeValues(OID_T targetVertexId)Get an iterable over the values of all edges with the given target vertex id.GiraphEdgeManager<OID_T,EDATA_T>getEdgeManager()Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>>getEdges()Get a read-only view of the out-edges of this vertex.EDATA_TgetEdgeValue(OID_T targetVertexId)Return the value of the first edge with the given target vertex id, or null if there is no such edge.OID_TgetId()Get the vertex id.longgetLocalId()Iterable<org.apache.giraph.edge.MutableEdge<OID_T,EDATA_T>>getMutableEdges()Get an iterable of out-edges that can be modified in-place.intgetNumEdges()Get the number of outgoing edges on this vertex.VDATA_TgetValue()Get the vertex value (data stored with vertex)VertexDataManagergetVertexDataManager()GiraphVertexIdManagergetVertexIdManager()voidinitialize(OID_T id, VDATA_T value)Initialize id and value.voidinitialize(OID_T id, VDATA_T value, Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>> edges)Initialize id, value, and edges.booleanisHalted()Is this vertex done?voidremoveEdges(OID_T targetVertexId)Removes all edges pointing to the given vertex id.voidsetEdgeManager(GiraphEdgeManager<OID_T,EDATA_T> edgeManager)voidsetEdges(Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>> edges)Set the outgoing edges for this vertex.voidsetEdgeValue(OID_T targetVertexId, EDATA_T edgeValue)If an edge to the target vertex exists, set it to the given edge value.voidsetLocalId(int lid)voidsetValue(VDATA_T value)Set the vertex data (immediately visible in the computation)voidsetVertexDataManager(VertexDataManager vertexDataManager)voidsetVertexIdManager(GiraphVertexIdManager vertexIdManager)voidunwrapMutableEdges()If aMutableEdgesWrapperwas used to provide a mutable iterator, copy any remaining edges to the newOutEdgesdata structure and keep a direct reference to it (thus discarding the wrapper).voidvoteToHalt()After this is called, the compute() code will no longer be called for this vertex unless a message is sent to it.voidwakeUp()Re-activate vertex if halted.-
Methods inherited from class org.apache.giraph.conf.DefaultImmutableClassesGiraphConfigurable
getConf, setConf
-
-
-
-
Constructor Detail
-
VertexImpl
public VertexImpl()
Usually the default constructor is only used when we load vertex with vif.
-
VertexImpl
public VertexImpl(GiraphComputationAdaptorContext ctx)
-
-
Method Detail
-
getVertexDataManager
public VertexDataManager getVertexDataManager()
-
setVertexDataManager
public void setVertexDataManager(VertexDataManager vertexDataManager)
-
getVertexIdManager
public GiraphVertexIdManager getVertexIdManager()
-
setVertexIdManager
public void setVertexIdManager(GiraphVertexIdManager vertexIdManager)
-
getEdgeManager
public GiraphEdgeManager<OID_T,EDATA_T> getEdgeManager()
-
setEdgeManager
public void setEdgeManager(GiraphEdgeManager<OID_T,EDATA_T> edgeManager)
-
initialize
public void initialize(OID_T id, VDATA_T value, Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>> edges)
Initialize id, value, and edges. This method (or the alternative form initialize(id, value)) must be called after instantiation, unless readFields() is called.
-
initialize
public void initialize(OID_T id, VDATA_T value)
Initialize id and value. Vertex edges will be empty. This method (or the alternative form initialize(id, value, edges)) must be called after instantiation, unless readFields() is called.
-
getId
public OID_T getId()
Get the vertex id.
-
getValue
public VDATA_T getValue()
Get the vertex value (data stored with vertex)
-
setValue
public void setValue(VDATA_T value)
Set the vertex data (immediately visible in the computation)
-
voteToHalt
public void voteToHalt()
After this is called, the compute() code will no longer be called for this vertex unless a message is sent to it. Then the compute() code will be called once again until this function is called. The application finishes only when all vertices vote to halt.
-
getNumEdges
public int getNumEdges()
Get the number of outgoing edges on this vertex.
-
getEdges
public Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>> getEdges()
Get a read-only view of the out-edges of this vertex. Note: edge objects returned by this iterable may be invalidated as soon as the next element is requested. Thus, keeping a reference to an edge almost always leads to undesired behavior. Accessing the edges with other methods (e.g., addEdge()) during iteration leads to undefined behavior.
-
setEdges
public void setEdges(Iterable<org.apache.giraph.edge.Edge<OID_T,EDATA_T>> edges)
Set the outgoing edges for this vertex.
-
getMutableEdges
public Iterable<org.apache.giraph.edge.MutableEdge<OID_T,EDATA_T>> getMutableEdges()
Get an iterable of out-edges that can be modified in-place. This can mean changing the current edge value or removing the current edge (by using the iterator version). Note: accessing the edges with other methods (e.g., addEdge()) during iteration leads to undefined behavior.
-
getEdgeValue
public EDATA_T getEdgeValue(OID_T targetVertexId)
Return the value of the first edge with the given target vertex id, or null if there is no such edge. Note: edge value objects returned by this method may be invalidated by the next call. Thus, keeping a reference to an edge value almost always leads to undesired behavior.
-
setEdgeValue
public void setEdgeValue(OID_T targetVertexId, EDATA_T edgeValue)
If an edge to the target vertex exists, set it to the given edge value. This only makes sense with strict graphs.
-
getAllEdgeValues
public Iterable<EDATA_T> getAllEdgeValues(OID_T targetVertexId)
Get an iterable over the values of all edges with the given target vertex id. This only makes sense for multigraphs (i.e. graphs with parallel edges). Note: edge value objects returned by this method may be invalidated as soon as the next element is requested. Thus, keeping a reference to an edge value almost always leads to undesired behavior.
-
addEdge
public void addEdge(org.apache.giraph.edge.Edge<OID_T,EDATA_T> edge)
Add an edge for this vertex (happens immediately)
-
removeEdges
public void removeEdges(OID_T targetVertexId)
Removes all edges pointing to the given vertex id.
-
unwrapMutableEdges
public void unwrapMutableEdges()
If aMutableEdgesWrapperwas used to provide a mutable iterator, copy any remaining edges to the newOutEdgesdata structure and keep a direct reference to it (thus discarding the wrapper). Called by the Giraph infrastructure after computation.
-
wakeUp
public void wakeUp()
Re-activate vertex if halted.
-
isHalted
public boolean isHalted()
Is this vertex done?
-
getLocalId
public long getLocalId()
-
setLocalId
public void setLocalId(int lid)
-
-