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>

  • 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.
    • Method Detail

      • getNumEdges

        public int getNumEdges​(long lid)
        Get the number of outgoing edges on a vertex with its lid.
        Specified by:
        getNumEdges in interface GiraphEdgeManager<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:
        getEdges in interface GiraphEdgeManager<GRAPE_OID_T,​GRAPE_VID_T>
        Parameters:
        lid -
        Returns:
        the out edges (sort order determined by subclass implementation).
      • 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:
        getMutableEdges in interface GiraphEdgeManager<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:
        getEdgeValue in interface GiraphEdgeManager<GRAPE_OID_T,​GRAPE_VID_T>
        Parameters:
        targetVertexId - Target vertex id
        Returns:
        edge value (or null if missing)
      • 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:
        getAllEdgeValues in interface GiraphEdgeManager<GRAPE_OID_T,​GRAPE_VID_T>
        Parameters:
        targetVertexId - Target vertex id
        Returns:
        Iterable of edge values
      • unwrapMutableEdges

        public void unwrapMutableEdges()
        Description copied from interface: GiraphEdgeManager
        If a MutableEdgesWrapper was used to provide a mutable iterator, copy any remaining edges to the new OutEdges data structure and keep a direct reference to it (thus discarding the wrapper). Called by the Giraph infrastructure after computation.
        Specified by:
        unwrapMutableEdges in interface GiraphEdgeManager<GRAPE_OID_T,​GRAPE_VID_T>