Package org.neo4j.gds.api
Interface AdjacencyCursor
-
- All Known Implementing Classes:
AdjacencyCursor.EmptyAdjacencyCursor
,BlockAlignedTailCursor
,CompositeAdjacencyCursor
,CompressedAdjacencyList.DecompressingCursor
,InlinedHeadPackedTailCursor
,NodeFilteredAdjacencyCursor
,PackedTailCursor
,UncompressedAdjacencyList.Cursor
,VarLongTailCursor
public interface AdjacencyCursor
Cursor iterating over the target ids of one adjacency list. A lot of the methods here are very low-level and break when looked at slightly askew. Better iteration methods and defined access patterns will be added under the continuation of Adjacency Compression III – Return of the Iterator
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
AdjacencyCursor.EmptyAdjacencyCursor
-
Field Summary
Fields Modifier and Type Field Description static long
NOT_FOUND
Special ID value that could be returned to indicate that no valid value can be produced
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description long
advance(long nodeId)
Read and decode target ids until it is larger than or equal (>=) the providedtarget
.long
advanceBy(int n)
Advance this cursor byn
elements.static AdjacencyCursor
empty()
Returns a cursor that is always empty.boolean
hasNextVLong()
Return true iff there is at least one more target to decode.void
init(long index, int degree)
Initialize this cursor to point to the givenindex
.long
nextVLong()
Read and decode the next target id.long
peekVLong()
Decode and peek the next target id.int
remaining()
Return how many targets are still left to be decoded.@NotNull AdjacencyCursor
shallowCopy(@Nullable AdjacencyCursor destination)
Create a shallow copy of this cursor.int
size()
Return how many targets can be decoded in total.long
skipUntil(long nodeId)
Read and decode target ids until it is strictly larger than (>) the providedtarget
.
-
-
-
Field Detail
-
NOT_FOUND
static final long NOT_FOUND
Special ID value that could be returned to indicate that no valid value can be produced- See Also:
- Constant Field Values
-
-
Method Detail
-
init
void init(long index, int degree)
Initialize this cursor to point to the givenindex
. The correct value for the index is highly implementation specific. The better way get initialize a cursor is throughAdjacencyList.adjacencyCursor(long)
or related.
-
size
int size()
Return how many targets can be decoded in total. This is equivalent to the degree.
-
hasNextVLong
boolean hasNextVLong()
Return true iff there is at least one more target to decode.
-
nextVLong
long nextVLong()
Read and decode the next target id. It is undefined behavior if this is called afterhasNextVLong()
returnsfalse
.
-
peekVLong
long peekVLong()
Decode and peek the next target id. Does not progress the internal cursor unlikenextVLong()
. It is undefined behavior if this is called afterhasNextVLong()
returnsfalse
.
-
remaining
int remaining()
Return how many targets are still left to be decoded.
-
skipUntil
long skipUntil(long nodeId)
Read and decode target ids until it is strictly larger than (>) the providedtarget
. If there are no such targets before this cursor is exhausted,-1
is returned.
-
advance
long advance(long nodeId)
Read and decode target ids until it is larger than or equal (>=) the providedtarget
. If there are no such targets before this cursor is exhausted,-1
is returned.
-
advanceBy
long advanceBy(int n)
Advance this cursor byn
elements. For a cursor in its initial position, this is equivalent tonth
.- Parameters:
n
- the number of elements to advance by. Must be positive.- Returns:
- the target after the advancement or
-1
if the cursor is exhausted.
-
shallowCopy
@NotNull @NotNull AdjacencyCursor shallowCopy(@Nullable @Nullable AdjacencyCursor destination)
Create a shallow copy of this cursor. Iteration state is copied and will advance independently from this cursor. The underlying data might be shared between instances. If the provideddestination
argument is not null, it might be re-used instead of having to create a new instance. It is *not* guaranteed that thedestination
will be reused. If thedestination
is not if the same type than this cursor, the behavior of this method in undefined.
-
empty
static AdjacencyCursor empty()
Returns a cursor that is always empty.
-
-