Zog.SoA (Zog v0.1.0)
View SourceBuild graphs for the native Zog (Zig) backend using arbitrary labels.
This module accumulates data into flat arrays that are ready to pass to Zigler NIFs.
Summary
Types
Graph type
Internal integer node id (maps to Zog's u32 index)
Any type can be used as a label
Zog SoA struct
Functions
Adds an edge between two labeled nodes with a weight.
Adds a node with the given label.
Adds a simple edge with weight 1 between two labeled nodes.
Adds an unweighted edge (weight defaults to 1.0).
Returns all edges as {from_id, to_id, weight} tuples.
Returns all labels in insertion order.
Creates a new directed Zog SoA builder.
Returns the number of directed edges stored.
Gets or creates a node for the given label.
Converts a Yog.Builder.Labeled into a Zog.SoA struct.
Creates a builder from a list of labeled edges.
Creates a builder from a list of unweighted labeled edges.
Returns the label for a given internal id.
Returns the internal id for a given label.
Creates a new Zog SoA builder of the specified type.
Returns the number of nodes.
Extracts edges as parallel arrays suitable for NIF passing.
Converts the SoA struct back to a standard Yog.Graph.
Converts the SoA struct back to a Graph (from libgraph).
Creates a new undirected Zog SoA builder.
Types
@type graph_type() :: :directed | :undirected
Graph type
@type id() :: non_neg_integer()
Internal integer node id (maps to Zog's u32 index)
@type label() :: term()
Any type can be used as a label
@type t() :: %Zog.SoA{ edges: [{id(), id(), float()}], id_to_label: %{required(id()) => label()}, integer_labels: boolean(), kind: graph_type(), label_to_id: %{required(label()) => id()}, next_id: non_neg_integer(), nodes: [label()] }
Zog SoA struct
Functions
Adds an edge between two labeled nodes with a weight.
Adds a node with the given label.
Adds a simple edge with weight 1 between two labeled nodes.
Adds an unweighted edge (weight defaults to 1.0).
Returns all edges as {from_id, to_id, weight} tuples.
Returns all labels in insertion order.
@spec directed() :: t()
Creates a new directed Zog SoA builder.
@spec edge_count(t()) :: non_neg_integer()
Returns the number of directed edges stored.
Gets or creates a node for the given label.
@spec from_labeled(Yog.Builder.Labeled.t()) :: t()
Converts a Yog.Builder.Labeled into a Zog.SoA struct.
@spec from_list(graph_type(), [{label(), label(), term()}]) :: t()
Creates a builder from a list of labeled edges.
@spec from_unweighted_list(graph_type(), [{label(), label()}]) :: t()
Creates a builder from a list of unweighted labeled edges.
Returns the label for a given internal id.
Returns the internal id for a given label.
@spec new(graph_type()) :: t()
Creates a new Zog SoA builder of the specified type.
@spec node_count(t()) :: non_neg_integer()
Returns the number of nodes.
Extracts edges as parallel arrays suitable for NIF passing.
Converts the SoA struct back to a standard Yog.Graph.
Converts the SoA struct back to a Graph (from libgraph).
@spec undirected() :: t()
Creates a new undirected Zog SoA builder.