# emirpasic/gods architecture

> Architecture diagram of the GitHub repository emirpasic/gods, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/emirpasic/gods
- Repository: https://github.com/emirpasic/gods

## Overview

GoDS is a Go library of generic data structures, not a hosted service: callers choose a collection, use its operations, and retrieve values or traverse its contents. Its major stages are sequence, set, map, tree, queue, and stack operations; shared interfaces, iterators, serialization, and comparators support those APIs. The graph preserves the README’s principal structure families and shows only sampled implementation dependencies. Other package-level wiring is not inferred from the excerpts.

Main entry points: [`lists/arraylist/arraylist.go`](https://github.com/emirpasic/gods/blob/master/lists/arraylist/arraylist.go) (ArrayList), [`lists/doublylinkedlist/doublylinkedlist.go`](https://github.com/emirpasic/gods/blob/master/lists/doublylinkedlist/doublylinkedlist.go) (DoublyLinkedList), [`lists/singlylinkedlist/singlylinkedlist.go`](https://github.com/emirpasic/gods/blob/master/lists/singlylinkedlist/singlylinkedlist.go) (SinglyLinkedList), [`trees/redblacktree/redblacktree.go`](https://github.com/emirpasic/gods/blob/master/trees/redblacktree/redblacktree.go) (RedBlackTree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lists["Lists"]
  node_arraylist["ArrayList<br/>[arraylist.go]"]
  node_singlylist["SinglyLinkedList"]
  node_doublylist["DoublyLinkedList"]
end

subgraph group_sets_maps["Sets and Maps"]
  node_hashset["HashSet<br/>[hashset.go]"]
  node_treeset["TreeSet<br/>[treeset.go]"]
  node_linkedhashset["LinkedHashSet<br/>[linkedhashset.go]"]
  node_hashmap["HashMap<br/>[hashmap.go]"]
  node_treemap["TreeMap<br/>[treemap.go]"]
  node_linkedhashmap["LinkedHashMap<br/>[linkedhashmap.go]"]
  node_hashbidimap["HashBidiMap<br/>[hashbidimap.go]"]
  node_treebidimap["TreeBidiMap<br/>[treebidimap.go]"]
end

subgraph group_trees["Trees"]
  node_redblacktree["RedBlackTree<br/>[redblacktree.go]"]
  node_avltree["AVLTree<br/>[avltree.go]"]
  node_btree["BTree<br/>[btree.go]"]
  node_binaryheap["BinaryHeap<br/>[binaryheap.go]"]
end

subgraph group_linear["Queues and Stacks"]
  node_linkedqueue["LinkedListQueue<br/>[linkedlistqueue.go]"]
  node_arrayqueue["ArrayQueue<br/>[arrayqueue.go]"]
  node_circularbuffer["CircularBuffer<br/>[circularbuffer.go]"]
  node_priorityqueue["PriorityQueue<br/>[priorityqueue.go]"]
  node_arraystack["ArrayStack<br/>[arraystack.go]"]
  node_linkedstack["LinkedListStack<br/>[linkedliststack.go]"]
end

subgraph group_shared["Shared APIs"]
  node_container_contract["Container contracts<br/>[containers.go]"]
  node_iterator_contract["Iterator contracts<br/>[iterator.go]"]
  node_serialization["Serialization<br/>[serialization.go]"]
  node_comparator["Comparators<br/>[comparator.go]"]
end

node_caller(("Go caller"))

node_caller -->|"uses"| node_arraylist
node_caller -->|"uses"| node_singlylist
node_caller -->|"uses"| node_doublylist
node_caller -->|"uses"| node_hashset
node_caller -->|"uses"| node_treeset
node_caller -->|"uses"| node_linkedhashset
node_caller -->|"uses"| node_hashmap
node_caller -->|"uses"| node_treemap
node_caller -->|"uses"| node_linkedhashmap
node_caller -->|"uses"| node_hashbidimap
node_caller -->|"uses"| node_treebidimap
node_caller -->|"uses"| node_redblacktree
node_caller -->|"uses"| node_avltree
node_caller -->|"uses"| node_btree
node_caller -->|"uses"| node_binaryheap
node_caller -->|"uses"| node_linkedqueue
node_caller -->|"uses"| node_arrayqueue
node_caller -->|"uses"| node_circularbuffer
node_caller -->|"uses"| node_priorityqueue
node_caller -->|"uses"| node_arraystack
node_caller -->|"uses"| node_linkedstack
node_treeset -->|"stores items in"| node_redblacktree
node_treemap -->|"stores pairs in"| node_redblacktree
node_binaryheap -->|"stores values in"| node_arraylist
node_linkedhashset -->|"tracks ordering with"| node_doublylist
node_arraylist -->|"implements"| node_container_contract
node_singlylist -->|"implements"| node_container_contract
node_doublylist -->|"implements"| node_container_contract
node_arraylist -->|"supports traversal"| node_iterator_contract
node_singlylist -->|"supports traversal"| node_iterator_contract
node_doublylist -->|"supports traversal"| node_iterator_contract
node_arraylist -->|"serializes"| node_serialization
node_singlylist -->|"serializes"| node_serialization
node_doublylist -->|"serializes"| node_serialization
node_treemap -->|"orders keys with"| node_comparator
node_treeset -->|"orders items with"| node_comparator
node_redblacktree -->|"compares keys with"| node_comparator

click node_arraylist "https://github.com/emirpasic/gods/blob/master/lists/arraylist/arraylist.go"
click node_singlylist "https://github.com/emirpasic/gods/blob/master/lists/singlylinkedlist/singlylinkedlist.go"
click node_doublylist "https://github.com/emirpasic/gods/blob/master/lists/doublylinkedlist/doublylinkedlist.go"
click node_hashset "https://github.com/emirpasic/gods/blob/master/sets/hashset/hashset.go"
click node_treeset "https://github.com/emirpasic/gods/blob/master/sets/treeset/treeset.go"
click node_linkedhashset "https://github.com/emirpasic/gods/blob/master/sets/linkedhashset/linkedhashset.go"
click node_hashmap "https://github.com/emirpasic/gods/blob/master/maps/hashmap/hashmap.go"
click node_treemap "https://github.com/emirpasic/gods/blob/master/maps/treemap/treemap.go"
click node_linkedhashmap "https://github.com/emirpasic/gods/blob/master/maps/linkedhashmap/linkedhashmap.go"
click node_hashbidimap "https://github.com/emirpasic/gods/blob/master/maps/hashbidimap/hashbidimap.go"
click node_treebidimap "https://github.com/emirpasic/gods/blob/master/maps/treebidimap/treebidimap.go"
click node_redblacktree "https://github.com/emirpasic/gods/blob/master/trees/redblacktree/redblacktree.go"
click node_avltree "https://github.com/emirpasic/gods/blob/master/trees/avltree/avltree.go"
click node_btree "https://github.com/emirpasic/gods/blob/master/trees/btree/btree.go"
click node_binaryheap "https://github.com/emirpasic/gods/blob/master/trees/binaryheap/binaryheap.go"
click node_linkedqueue "https://github.com/emirpasic/gods/blob/master/queues/linkedlistqueue/linkedlistqueue.go"
click node_arrayqueue "https://github.com/emirpasic/gods/blob/master/queues/arrayqueue/arrayqueue.go"
click node_circularbuffer "https://github.com/emirpasic/gods/blob/master/queues/circularbuffer/circularbuffer.go"
click node_priorityqueue "https://github.com/emirpasic/gods/blob/master/queues/priorityqueue/priorityqueue.go"
click node_arraystack "https://github.com/emirpasic/gods/blob/master/stacks/arraystack/arraystack.go"
click node_linkedstack "https://github.com/emirpasic/gods/blob/master/stacks/linkedliststack/linkedliststack.go"
click node_container_contract "https://github.com/emirpasic/gods/blob/master/containers/containers.go"
click node_iterator_contract "https://github.com/emirpasic/gods/blob/master/containers/iterator.go"
click node_serialization "https://github.com/emirpasic/gods/blob/master/containers/serialization.go"
click node_comparator "https://github.com/emirpasic/gods/blob/master/utils/comparator.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_arraylist,node_singlylist,node_doublylist toneBlue
class node_hashset,node_treeset,node_linkedhashset,node_hashmap,node_treemap,node_linkedhashmap,node_hashbidimap,node_treebidimap toneAmber
class node_redblacktree,node_avltree,node_btree,node_binaryheap toneMint
class node_linkedqueue,node_arrayqueue,node_circularbuffer,node_priorityqueue,node_arraystack,node_linkedstack toneRose
class node_container_contract,node_iterator_contract,node_serialization,node_comparator,node_caller toneIndigo
```

## Components

### Lists

- [ArrayList](https://github.com/emirpasic/gods/blob/master/lists/arraylist/arraylist.go): `lists/arraylist/arraylist.go`
- [SinglyLinkedList](https://github.com/emirpasic/gods/blob/master/lists/singlylinkedlist/singlylinkedlist.go): `lists/singlylinkedlist/singlylinkedlist.go`
- [DoublyLinkedList](https://github.com/emirpasic/gods/blob/master/lists/doublylinkedlist/doublylinkedlist.go): `lists/doublylinkedlist/doublylinkedlist.go`

### Sets and Maps

- [HashSet](https://github.com/emirpasic/gods/blob/master/sets/hashset/hashset.go): `sets/hashset/hashset.go`
- [TreeSet](https://github.com/emirpasic/gods/blob/master/sets/treeset/treeset.go): `sets/treeset/treeset.go`
- [LinkedHashSet](https://github.com/emirpasic/gods/blob/master/sets/linkedhashset/linkedhashset.go): `sets/linkedhashset/linkedhashset.go`
- [HashMap](https://github.com/emirpasic/gods/blob/master/maps/hashmap/hashmap.go): `maps/hashmap/hashmap.go`
- [TreeMap](https://github.com/emirpasic/gods/blob/master/maps/treemap/treemap.go): `maps/treemap/treemap.go`
- [LinkedHashMap](https://github.com/emirpasic/gods/blob/master/maps/linkedhashmap/linkedhashmap.go): `maps/linkedhashmap/linkedhashmap.go`
- [HashBidiMap](https://github.com/emirpasic/gods/blob/master/maps/hashbidimap/hashbidimap.go): `maps/hashbidimap/hashbidimap.go`
- [TreeBidiMap](https://github.com/emirpasic/gods/blob/master/maps/treebidimap/treebidimap.go): `maps/treebidimap/treebidimap.go`

### Trees

- [RedBlackTree](https://github.com/emirpasic/gods/blob/master/trees/redblacktree/redblacktree.go): `trees/redblacktree/redblacktree.go`
- [AVLTree](https://github.com/emirpasic/gods/blob/master/trees/avltree/avltree.go): `trees/avltree/avltree.go`
- [BTree](https://github.com/emirpasic/gods/blob/master/trees/btree/btree.go): `trees/btree/btree.go`
- [BinaryHeap](https://github.com/emirpasic/gods/blob/master/trees/binaryheap/binaryheap.go): `trees/binaryheap/binaryheap.go`

### Queues and Stacks

- [LinkedListQueue](https://github.com/emirpasic/gods/blob/master/queues/linkedlistqueue/linkedlistqueue.go): `queues/linkedlistqueue/linkedlistqueue.go`
- [ArrayQueue](https://github.com/emirpasic/gods/blob/master/queues/arrayqueue/arrayqueue.go): `queues/arrayqueue/arrayqueue.go`
- [CircularBuffer](https://github.com/emirpasic/gods/blob/master/queues/circularbuffer/circularbuffer.go): `queues/circularbuffer/circularbuffer.go`
- [PriorityQueue](https://github.com/emirpasic/gods/blob/master/queues/priorityqueue/priorityqueue.go): `queues/priorityqueue/priorityqueue.go`
- [ArrayStack](https://github.com/emirpasic/gods/blob/master/stacks/arraystack/arraystack.go): `stacks/arraystack/arraystack.go`
- [LinkedListStack](https://github.com/emirpasic/gods/blob/master/stacks/linkedliststack/linkedliststack.go): `stacks/linkedliststack/linkedliststack.go`

### Shared APIs

- [Container contracts](https://github.com/emirpasic/gods/blob/master/containers/containers.go): `containers/containers.go`
- [Iterator contracts](https://github.com/emirpasic/gods/blob/master/containers/iterator.go): `containers/iterator.go`
- [Serialization](https://github.com/emirpasic/gods/blob/master/containers/serialization.go): `containers/serialization.go`
- [Comparators](https://github.com/emirpasic/gods/blob/master/utils/comparator.go): `utils/comparator.go`

### Other components

- **Go caller**

## Connections

- Go caller → ArrayList: uses
- Go caller → SinglyLinkedList: uses
- Go caller → DoublyLinkedList: uses
- Go caller → HashSet: uses
- Go caller → TreeSet: uses
- Go caller → LinkedHashSet: uses
- Go caller → HashMap: uses
- Go caller → TreeMap: uses
- Go caller → LinkedHashMap: uses
- Go caller → HashBidiMap: uses
- Go caller → TreeBidiMap: uses
- Go caller → RedBlackTree: uses
- Go caller → AVLTree: uses
- Go caller → BTree: uses
- Go caller → BinaryHeap: uses
- Go caller → LinkedListQueue: uses
- Go caller → ArrayQueue: uses
- Go caller → CircularBuffer: uses
- Go caller → PriorityQueue: uses
- Go caller → ArrayStack: uses
- Go caller → LinkedListStack: uses
- TreeSet → RedBlackTree: stores items in
- TreeMap → RedBlackTree: stores pairs in
- BinaryHeap → ArrayList: stores values in
- LinkedHashSet → DoublyLinkedList: tracks ordering with
- ArrayList → Container contracts: implements
- SinglyLinkedList → Container contracts: implements
- DoublyLinkedList → Container contracts: implements
- ArrayList → Iterator contracts: supports traversal
- SinglyLinkedList → Iterator contracts: supports traversal
- DoublyLinkedList → Iterator contracts: supports traversal
- ArrayList → Serialization: serializes
- SinglyLinkedList → Serialization: serializes
- DoublyLinkedList → Serialization: serializes
- TreeMap → Comparators: orders keys with
- TreeSet → Comparators: orders items with
- RedBlackTree → Comparators: compares keys with
