Mnemosyne.Graph.Node protocol (mnemosyne v0.1.6)

Copy Markdown View Source

Protocol for polymorphic graph node operations.

All knowledge graph node types must implement this protocol to support uniform access to identity, embeddings, links, and type.

Summary

Types

t()

All the types that implement this protocol.

Functions

Returns the embedding vector, or nil if not set.

Returns the unique identifier of the node.

Returns all links grouped by edge type.

Returns the set of linked node IDs for a specific edge type.

Returns the atom identifying the node's type.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

embedding(node)

@spec embedding(t()) :: [float()] | nil

Returns the embedding vector, or nil if not set.

id(node)

@spec id(t()) :: String.t()

Returns the unique identifier of the node.

links(node)

@spec links(t()) :: %{required(Mnemosyne.Graph.Edge.edge_type()) => MapSet.t()}

Returns all links grouped by edge type.

links(node, edge_type)

@spec links(t(), Mnemosyne.Graph.Edge.edge_type()) :: MapSet.t()

Returns the set of linked node IDs for a specific edge type.

node_type(node)

@spec node_type(t()) :: atom()

Returns the atom identifying the node's type.