MCPcopy Index your code
hub / github.com/armon/go-radix

github.com/armon/go-radix @v1.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.0 ↗ · + Follow
42 symbols 132 edges 2 files 22 documented · 52% 39 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

go-radix Build Status

Provides the radix package that implements a radix tree. The package only provides a single Tree implementation, optimized for sparse nodes.

As a radix tree, it provides the following: * O(k) operations. In many cases, this can be faster than a hash table since the hash function is an O(k) operation, and hash tables have very poor cache locality. * Minimum / Maximum value lookups * Ordered iteration

For an immutable variant, see go-immutable-radix.

Documentation

The full documentation is available on Godoc.

Example

Below is a simple example of usage

// Create a tree
r := radix.New()
r.Insert("foo", 1)
r.Insert("bar", 2)
r.Insert("foobar", 2)

// Find the longest prefix match
m, _, _ := r.LongestPrefix("foozip")
if m != "foo" {
    panic("should be foo")
}

Extension points exported contracts — how you extend this code

WalkFn (FuncType)
WalkFn is used when walking the tree. Takes a key and value, returning if iteration should be terminated.
radix.go

Core symbols most depended-on inside this repo

Len
called by 10
radix.go
isLeaf
called by 9
radix.go
getEdge
called by 7
radix.go
Insert
called by 7
radix.go
New
called by 6
radix.go
Delete
called by 4
radix.go
recursiveWalk
called by 4
radix.go
addEdge
called by 3
radix.go

Shape

Method 23
Function 12
Struct 5
FuncType 1
TypeAlias 1

Languages

Go100%

Modules by API surface

radix.go33 symbols
radix_test.go9 symbols

For agents

$ claude mcp add go-radix \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact