comptime VertexRolesView[origin: ImmOrigin = ImmUntrackedOrigin]: AnyStruct[StridedView[VertexRole, origin]] = StridedView[VertexRole, origin] An edge is a source, a target and an optional edge identifier, so distinct identifiers let a pair of vertices share several edges. One collection holds an undirected or a directed graph over its own vertices, or a joining graph between two collections.
API
Types
VertexRolesViewA strided run of roles, ustore_vertex_roles_view_t; zeroed stands for ANY.
StructVertexRoleThe role a vertex plays in an edge, ustore_vertex_role_t; undirected graphs use ANY.
struct VertexRole Fields
code | c_int | The raw ustore_vertex_role_t value the ABI exchanges. |
|---|
Values
UNKNOWN | VertexRole(Int32(0)) | No role. |
|---|---|---|
SOURCE | VertexRole(Int32(1)) | The vertex an edge leaves. |
TARGET | VertexRole(Int32(2)) | The vertex an edge enters. |
ANY | VertexRole(Int32(3)) | Either end of an edge. |
Conforms to
Copyable, Deinitable, Equatable, ImplicitlyCopyable, Movable, RegisterPassable, TrivialRegisterPassableStructEdgesThe edges of a batch of vertices, three keys per edge, read in place from the arena a read borrows.5
struct Edges[origin: MutOrigin] Parameters
originMutOrigin | comptime | The arena the edges live in, which this result borrows. |
|---|
Fields
arena | Pointer[Arena, origin] | The arena holding the edges. |
|---|---|---|
generation | Int | The arena's call the edges came from. |
written | EdgesWritten | The views the engine wrote. |
count | Int | Vertices the read carried. |
Values
Written | EdgesWritten |
|---|
Conforms to
Answer, Deinitable, Movable, Sized__init__
def __init__(out self, arena: Int, generation: Int, written: EdgesWritten, count: Int) __len__The vertices the read carried.
def __len__(self) -> Int degreesThe degree of every vertex, VERTEX_DEGREE_MISSING for a missing one.
def degrees(ref self) -> Span[UInt32, origin_of(self)] offsetsThe vertices' boundaries in edges, one more of them than vertices; empty unless edges were asked for.
def offsets(ref self) -> Span[UInt64, origin_of(self)] edgesThe edges of vertex vertex, each as its source, target and edge identifier.
def edges(ref self, vertex: Int) -> Span[Key, origin_of(self)] StructGraphScanConfigThe bounds, order and verdict of a scan over vertices.1
struct GraphScanConfig[end_origin: ImmOrigin = ImmUntrackedOrigin] Parameters
end_originImmOrigin | comptime | The borrowed end keys. |
|---|
Fields
end_keys | StridedView[Key, end_origin] | Vertex every scan stops before, exclusive; zeroed bounds nothing. |
|---|---|---|
direction | ScanDirection | Ascending or descending from the start keys. |
mode | ScanMode | In what order the vertices come. |
predicate | Predicate | The caller's verdict on the listed vertices. |
progress | Progress | Reports the scans finished, and stops the call where it says to. |
Conforms to
Copyable, Deinitable, ImplicitlyCopyable, Movable__init__Names only the knobs that differ from the defaults.
def __init__(
out self,
*,
end_keys: StridedView[Key, end_origin] = StridedView(),
direction: ScanDirection = ScanDirection.ASCENDING,
mode: ScanMode = ScanMode.ORDERED,
predicate: Predicate = Predicate(),
progress: Progress = Progress()
) StructGraphVerticesCursorA walk over the vertices of one graph collection, every pull resuming past the last vertex the pull before it handed out, freed when it goes out of scope. It holds its database open, and the transaction or snapshot it reads through.3
struct GraphVerticesCursor Fields
library | Library | The loaded engine. |
|---|---|---|
database | Address | The ustore_database_t it walks. |
address | Address | The ustore_graph_vertices_cursor_t. |
Conforms to
Deinitable, Movable__init__Adopts a cursor the engine just opened.
def __init__(out self, *, library: Library, database: Int, address: Int) __deinit__Frees the cursor and the holds it kept. Calls ustore_graph_vertices_cursor_free.
def __deinit__(deinit self) nextPulls the next page of up to wanted vertices. Calls ustore_graph_vertices_cursor_next.
Constants
VERTEX_DEGREE_MISSINGThe degree a read reports for a missing vertex.
comptime VERTEX_DEGREE_MISSING = UInt32(4294967295)