Class DefaultImmutableEdgeManager<GRAPE_OID_T,GRAPE_VID_T,GRAPE_VDATA_T,GRAPE_EDATA_T,GIRAPH_OID_T extends org.apache.hadoop.io.WritableComparable,GIRAPH_EDATA_T extends org.apache.hadoop.io.Writable>
- java.lang.Object
-
- com.alibaba.graphscope.graph.AbstractEdgeManager<GRAPE_VID_T,GRAPE_OID_T,GIRAPH_OID_T,GRAPE_EDATA_T,GIRAPH_EDATA_T>
-
- com.alibaba.graphscope.graph.impl.DefaultImmutableEdgeManager<GRAPE_OID_T,GRAPE_VID_T,GRAPE_VDATA_T,GRAPE_EDATA_T,GIRAPH_OID_T,GIRAPH_EDATA_T>
-
- Type Parameters:
GRAPE_OID_T-GRAPE_VID_T-GRAPE_VDATA_T-GRAPE_EDATA_T-GIRAPH_OID_T-GIRAPH_EDATA_T-
- All Implemented Interfaces:
GiraphEdgeManager<GIRAPH_OID_T,GIRAPH_EDATA_T>
public class DefaultImmutableEdgeManager<GRAPE_OID_T,GRAPE_VID_T,GRAPE_VDATA_T,GRAPE_EDATA_T,GIRAPH_OID_T extends org.apache.hadoop.io.WritableComparable,GIRAPH_EDATA_T extends org.apache.hadoop.io.Writable> extends AbstractEdgeManager<GRAPE_VID_T,GRAPE_OID_T,GIRAPH_OID_T,GRAPE_EDATA_T,GIRAPH_EDATA_T> implements GiraphEdgeManager<GIRAPH_OID_T,GIRAPH_EDATA_T>
Default edge manager, which extract all edata and oids from grape before accessing them in queries.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classDefaultImmutableEdgeManager.GenericEdgeIterablestatic interfaceDefaultImmutableEdgeManager.ImmutableEdgeIterator<EDGE_OID_T extends org.apache.hadoop.io.WritableComparable,EDGE_DATA_T extends org.apache.hadoop.io.Writable>classDefaultImmutableEdgeManager.OnHeapEdgeIterator-
Nested classes/interfaces inherited from class com.alibaba.graphscope.graph.AbstractEdgeManager
AbstractEdgeManager.CSRHolder, AbstractEdgeManager.TupleIterable, AbstractEdgeManager.TupleIterator
-
-
Field Summary
-
Fields inherited from class com.alibaba.graphscope.graph.AbstractEdgeManager
csrHolder, edgeIterable, edgeIterables
-
-
Constructor Summary
Constructors Constructor Description DefaultImmutableEdgeManager(IFragment<GRAPE_OID_T,GRAPE_VID_T,GRAPE_VDATA_T,GRAPE_EDATA_T> fragment, GiraphVertexIdManager<GRAPE_VID_T,? extends GIRAPH_OID_T> idManager, ImmutableClassesGiraphConfiguration<?,?,?> configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEdge(org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T> edge)Add an edge for this vertex (happens immediately)Iterable<GIRAPH_EDATA_T>getAllEdgeValues(GIRAPH_OID_T targetVertexId)Get an iterable over the values of all edges with the given target vertex id.Iterable<org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T>>getEdges(long lid)Get a read-only view of the out-edges of this vertex.GIRAPH_EDATA_TgetEdgeValue(long lid, GIRAPH_OID_T targetVertexId)Return the value of the first edge with the given target vertex id, or null if there is no such edge.Iterable<org.apache.giraph.edge.MutableEdge<GIRAPH_OID_T,GIRAPH_EDATA_T>>getMutableEdges()Get an iterable of out-edges that can be modified in-place.intgetNumEdges(long lid)Get the number of outgoing edges on a vertex with its lid.voidremoveEdges(GIRAPH_OID_T targetVertexId)Removes all edges pointing to the given vertex id.voidsetEdges(Iterable<org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T>> edges)Set the outgoing edges for this vertex.voidsetEdgeValue(GIRAPH_OID_T targetVertexId, GIRAPH_EDATA_T edgeValue)If an edge to the target vertex exists, set it to the given edge value.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).-
Methods inherited from class com.alibaba.graphscope.graph.AbstractEdgeManager
getNumEdgesImpl, init, init
-
-
-
-
Constructor Detail
-
DefaultImmutableEdgeManager
public DefaultImmutableEdgeManager(IFragment<GRAPE_OID_T,GRAPE_VID_T,GRAPE_VDATA_T,GRAPE_EDATA_T> fragment, GiraphVertexIdManager<GRAPE_VID_T,? extends GIRAPH_OID_T> idManager, ImmutableClassesGiraphConfiguration<?,?,?> configuration)
-
-
Method Detail
-
getNumEdges
public int getNumEdges(long lid)
Get the number of outgoing edges on a vertex with its lid.- Specified by:
getNumEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
lid-- Returns:
- the total number of outbound edges from this vertex
-
getEdges
public Iterable<org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T>> getEdges(long lid)
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.- Specified by:
getEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
lid-- Returns:
- the out edges (sort order determined by subclass implementation).
-
setEdges
public void setEdges(Iterable<org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T>> edges)
Set the outgoing edges for this vertex.- Specified by:
setEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
edges- Iterable of edges
-
getMutableEdges
public Iterable<org.apache.giraph.edge.MutableEdge<GIRAPH_OID_T,GIRAPH_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.- Specified by:
getMutableEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Returns:
- An iterable of mutable out-edges
-
getEdgeValue
public GIRAPH_EDATA_T getEdgeValue(long lid, GIRAPH_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.- Specified by:
getEdgeValuein interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
targetVertexId- Target vertex id- Returns:
- edge value (or null if missing)
-
setEdgeValue
public void setEdgeValue(GIRAPH_OID_T targetVertexId, GIRAPH_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.- Specified by:
setEdgeValuein interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
targetVertexId- Target vertex idedgeValue- edge value
-
getAllEdgeValues
public Iterable<GIRAPH_EDATA_T> getAllEdgeValues(GIRAPH_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.- Specified by:
getAllEdgeValuesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
targetVertexId- Target vertex id- Returns:
- Iterable of edge values
-
addEdge
public void addEdge(org.apache.giraph.edge.Edge<GIRAPH_OID_T,GIRAPH_EDATA_T> edge)
Add an edge for this vertex (happens immediately)- Specified by:
addEdgein interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
edge- Edge to add
-
removeEdges
public void removeEdges(GIRAPH_OID_T targetVertexId)
Removes all edges pointing to the given vertex id.- Specified by:
removeEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>- Parameters:
targetVertexId- the target vertex id
-
unwrapMutableEdges
public void unwrapMutableEdges()
Description copied from interface:GiraphEdgeManagerIf 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.- Specified by:
unwrapMutableEdgesin interfaceGiraphEdgeManager<GRAPE_OID_T,GRAPE_VID_T>
-
-