# `Clarity.Vertex`
[🔗](https://github.com/team-alembic/clarity/blob/v0.5.1/lib/clarity/vertex.ex#L1)

Protocol for vertices in the `Clarity` graph.

# `t`

```elixir
@type t() :: term()
```

All the types that implement this protocol.

# `id`

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

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
    end

Where `@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).

# `name`

```elixir
@spec name(t()) :: String.t()
```

Returns the name of the vertex for display purposes.
This is typically used in the UI to show the name of the vertex.

# `type_label`

```elixir
@spec type_label(t()) :: String.t()
```

Returns the label for the type of the vertex.
This is used for displaying the type of the vertex in the graph.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
