explaingit

emirpasic/gods

17,427GoAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

GoDS is a Go library of ready-made data structures (trees, sets, queues, maps, linked lists) you can drop into any Go project without implementing them from scratch, with no external dependencies.

Mindmap

mindmap
  root((GoDS))
    What it does
      Go data structures
      No external dependencies
      Shared Container interface
    Containers
      Lists and LinkedLists
      Sets HashSet TreeSet
      Trees AVL RedBlack BTree
      Maps HashMap TreeMap BiMap
    Features
      Iterators reversible
      JSON serialization
      Enumerable operations
    Audience
      Go developers
      Algorithm implementers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Use a TreeMap for sorted key-value lookups in a Go service without implementing the tree yourself.

USE CASE 2

Add a PriorityQueue or CircularBuffer to a Go worker pool for bounded, ordered job processing.

USE CASE 3

Serialize a HashSet or AVLTree to JSON using the built-in JSONSerializer helpers.

USE CASE 4

Use a bidirectional map to look up values by key and keys by value in a Go application.

Tech stack

Go

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose including commercial, as long as you keep the BSD copyright notice.

In plain English

GoDS, short for Go Data Structures, is a Go library that implements a wide set of classic data structures and the algorithms that go with them. Data structures are the standard ways programmers organise values in memory so they can be added, looked up, ordered, or iterated over efficiently. Go's built-in language only ships slices and maps, so projects that need things like trees, sets, queues, or linked lists usually pull in a library like this one. The README groups what is provided into containers and helper functions. The containers include lists (ArrayList, SinglyLinkedList, DoublyLinkedList), sets (HashSet, TreeSet, LinkedHashSet), stacks, maps (HashMap, TreeMap, LinkedHashMap, plus bidirectional maps that let you look up by value too), trees (RedBlackTree, AVLTree, BTree, BinaryHeap), and queues (including a CircularBuffer and a PriorityQueue). Every container implements a shared Container interface with Empty, Size, Clear, Values, and String methods. Ordered containers also expose iterators (some reversible), and many support enumerable operations and JSON serialization through provided JSONSerializer and JSONDeserializer helpers. Someone would use this when they are writing Go code and need a data structure that is more specialised than slice or map without rolling it themselves, for example an AVL tree for sorted lookups, a circular buffer for a bounded queue, or a bidirectional map. The README includes code examples for each structure showing exactly which methods are available. The tech stack is Go, with no dependencies beyond the standard library, and the project is BSD 2-Clause licensed. The full README is longer than what was provided.

Copy-paste prompts

Prompt 1
Show me how to use GoDS RedBlackTree in Go to store and iterate sorted string keys with their associated values.
Prompt 2
How do I create a GoDS PriorityQueue with a custom comparator to process jobs in priority order in Go?
Prompt 3
Give me an example of using GoDS BiMap to do reverse lookups (value to key) in Go.
Prompt 4
How do I serialize and deserialize a GoDS TreeSet to and from JSON?
Prompt 5
Walk me through using GoDS DoublyLinkedList to implement an LRU cache in Go.
Open on GitHub → Explain another repo

← emirpasic on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.