https://github.com/0xnu/phtree
PH-tree (Permutation Hierarchical Tree) implementation in Go.
https://github.com/0xnu/phtree
golang high-dimensional phtree sparse
Last synced: 5 months ago
JSON representation
PH-tree (Permutation Hierarchical Tree) implementation in Go.
- Host: GitHub
- URL: https://github.com/0xnu/phtree
- Owner: 0xnu
- License: mit
- Created: 2024-04-05T00:41:30.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-05T02:42:50.000Z (almost 2 years ago)
- Last Synced: 2025-07-22T20:46:58.769Z (7 months ago)
- Topics: golang, high-dimensional, phtree, sparse
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: CODEOWNERS
- Security: SECURITY.md
Awesome Lists containing this project
README
## phtree
[](https://github.com/0xnu/phtree/releases/latest)
[](https://goreportcard.com/report/github.com/0xnu/phtree)
[](https://pkg.go.dev/github.com/0xnu/phtree)
[](/LICENSE)
[PH-tree](https://en.wikipedia.org/wiki/PH-tree) (Permutation Hierarchical Tree) implementation in Go.
### Features
- Insertion and search operations for multi-dimensional keys
- Removal of key-value pairs from the tree
- Configurable maximum depth of the tree
- Thread-safe concurrent access to the tree
- Efficient handling of high-dimensional and sparse data
### Installation
Install the `phtree` package in your `Go` project by installing it with the following command:
```shell
go get github.com/0xnu/phtree
```
### Usage
Here's a basic example of how to use the `phtree` package:
```go
package main
import (
"fmt"
"github.com/0xnu/phtree"
)
func main() {
tree := phtree.New(phtree.WithMaxDepth(8))
tree.Insert([]uint64{0, 1, 2}, "apple")
tree.Insert([]uint64{0, 1, 3}, "banana")
value := tree.Search([]uint64{0, 1, 2})
fmt.Println(value) // Output: "apple"
tree.Remove([]uint64{0, 1, 3})
}
```
Check out the [examples](./examples/) directory for more detailed usage and examples.
### Testing
To run the tests for the PH-Tree package, use the following command:
```sh
go test
```
### Performance
To run the benchmarking code, you can use the following command:
```sh
go run benchmark/benchmark.go
```
### License
This project is licensed under the [MIT License](./LICENSE).
### Copyright
(c) 2024 [Finbarrs Oketunji](https://finbarrs.eu).