Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/craig-day/linked_map


https://github.com/craig-day/linked_map

data-structures elixir ordered-collections ordered-map

Last synced: 20 days ago
JSON representation

Awesome Lists containing this project

README

        

# LinkedMap

A LinkedMap is a order-aware collection with the following properties:

- A `head` pointer
- A `tail` pointer
- A collection of `items` that can be added to, removed from, and traversed
in either direction

I built this to have a collection I can traverse in either direction, but also
be able to remove items in less-than-linear time. I also didn't want something
that needed to be sorted or rebalanced after each addition or removal.

This uses Elixir's [`Map`](https://hexdocs.pm/elixir/Map.html) underneath, so
removing arbitrary items can happen in logarithmic time, rather than linear
time that most sorted collections incur.

## Installation

Add `linked_map` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:linked_map, "~> 0.2.0"}
]
end
```

## Usage

See the [documentation](https://hexdocs.pm/linked_map) for API reference and examples.