Clarity.Vertex protocol (Clarity v0.4.0)
View SourceProtocol for vertices in the Clarity graph.
Summary
Functions
Returns a unique identifier for the vertex.
Returns the name of the vertex for display purposes. This is typically used in the UI to show the name of the vertex.
Returns the label for the type of the vertex. This is used for displaying the type of the vertex in the graph.
Types
@type t() :: term()
All the types that implement this protocol.
Functions
Returns a unique identifier for the vertex.
Used for identifying vertices in the graph, including in the UI of the dashboard.
Implementation
Implementations should use Clarity.Vertex.Util.id/2 to generate the ID:
defimpl Clarity.Vertex do
alias Clarity.Vertex.Util
@impl Clarity.Vertex
def id(vertex) do
Util.id(@for, [identifying_parts])
end
endWhere @for refers to the struct module being implemented for, and identifying_parts
is a list of values that uniquely identify this vertex (e.g., module names, atoms, strings).
Returns the name of the vertex for display purposes. This is typically used in the UI to show the name of the vertex.
Returns the label for the type of the vertex. This is used for displaying the type of the vertex in the graph.