GraphBLAS-backed sparse graph (ExOKF extension).
Maps concept identifiers onto dense integer indices and will use
ex_graphblas sparse relations for reachability, transitive closure,
dependency analysis, and cycle detection.
Full acceleration lands in v0.2. In v0.1 this module implements the
ExOKF.Graph.Backend behaviour by delegating to ExOKF.Graph.Adjacency
so callers can select the backend without changing code paths.
Fields
| Field | Type | Description |
|---|---|---|
adjacency | ExOKF.Graph.Adjacency.t() | Underlying adjacency graph used for v0.1 queries. |
id_to_index | %{optional(String.t()) => non_neg_integer()} | Concept id → dense index. |
index_to_id | %{optional(non_neg_integer()) => String.t()} | Dense index → concept id. |
Example
%ExOKF.Graph.GraphBLAS{
adjacency: %ExOKF.Graph.Adjacency{},
id_to_index: %{"datasets/sales" => 0, "tables/customers" => 1, "tables/orders" => 2},
index_to_id: %{0 => "datasets/sales", 1 => "tables/customers", 2 => "tables/orders"}
}
Summary
Functions
Builds a GraphBLAS handle with dense id↔index maps.
Returns the number of directed edges (delegates to adjacency).
Returns all directed edges (delegates to adjacency).
Returns true when edge from → to exists (delegates to adjacency).
Returns the concept id for a dense integer index, or nil if unmapped.
Returns the dense integer index for a concept id, or nil if unmapped.
Returns sorted outbound neighbors of id (delegates to adjacency).
Returns the number of concept nodes (delegates to adjacency).
Returns concept ids reachable from id (delegates to adjacency).
Returns sorted inbound neighbors of id (delegates to adjacency).
Types
@type t() :: %ExOKF.Graph.GraphBLAS{ adjacency: ExOKF.Graph.Adjacency.t(), id_to_index: %{optional(String.t()) => non_neg_integer()}, index_to_id: %{optional(non_neg_integer()) => String.t()} }
GraphBLAS-oriented graph handle (v0.1 delegates compute to adjacency).
See the module documentation for field meanings.
Functions
@spec build(ExOKF.Bundle.t()) :: t()
Builds a GraphBLAS handle with dense id↔index maps.
Parameters
bundle(ExOKF.Bundle.t()) — loaded OKF bundle
Examples
iex> bundle = ExOKF.TestSupport.sample_bundle()
iex> g = ExOKF.Graph.GraphBLAS.build(bundle)
iex> is_integer(ExOKF.Graph.GraphBLAS.index_of(g, "tables/orders"))
true
@spec edge_count(t()) :: non_neg_integer()
Returns the number of directed edges (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handle
Returns all directed edges (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handle
Returns true when edge from → to exists (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handlefrom(String.t()) — source concept idto(String.t()) — target concept id
@spec id_of(t(), non_neg_integer()) :: String.t() | nil
Returns the concept id for a dense integer index, or nil if unmapped.
Parameters
graph(t/0) — GraphBLAS handleindex(non_neg_integer()) — dense index
Examples
iex> g = ExOKF.Graph.GraphBLAS.build(ExOKF.TestSupport.sample_bundle())
iex> id = ExOKF.Graph.GraphBLAS.id_of(g, 0)
iex> is_binary(id)
true
@spec index_of(t(), String.t()) :: non_neg_integer() | nil
Returns the dense integer index for a concept id, or nil if unmapped.
Parameters
graph(t/0) — GraphBLAS handleid(String.t()) — concept id
Examples
iex> g = ExOKF.Graph.GraphBLAS.build(ExOKF.TestSupport.sample_bundle())
iex> ExOKF.Graph.GraphBLAS.index_of(g, "missing")
nil
Returns sorted outbound neighbors of id (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handleid(String.t()) — concept id
@spec node_count(t()) :: non_neg_integer()
Returns the number of concept nodes (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handle
Returns concept ids reachable from id (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handleid(String.t()) — start concept idopts(keyword()) — seeExOKF.Graph.Adjacency.reachable/3
Returns sorted inbound neighbors of id (delegates to adjacency).
Parameters
graph(t/0) — GraphBLAS handleid(String.t()) — concept id