All Projects → jwangsadinata → go-multimap

jwangsadinata / go-multimap

Licence: MIT License
Go-Multimap is an implementation of the `multimap` data structure in Go.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-multimap

trimeter
(not ready yet) A simple but powerful job scheduler for Trio programs
Stars: ✭ 48 (+54.84%)
Mutual labels:  map
closeable-map
Application state management made simple: a Clojure map that implements java.io.Closeable.
Stars: ✭ 42 (+35.48%)
Mutual labels:  map
ClimateChangeProjections
An embeddable map that shows climate change projections. How hot will it be by 2070 if we don't do something about it? Accessible at https://climatechange.codeforafrica.org
Stars: ✭ 29 (-6.45%)
Mutual labels:  map
FramerMapboxJS
Simplest way to integrate Mapbox maps on your Framer prototypes.
Stars: ✭ 45 (+45.16%)
Mutual labels:  map
mbmatch
An MBTiles server for PBF, which is also a map matcher.
Stars: ✭ 34 (+9.68%)
Mutual labels:  map
ReminderPro
ReminderPro(location, note, voice recording)
Stars: ✭ 27 (-12.9%)
Mutual labels:  map
leaflet.TravelNotes
A complete mapping application. With this, you prepare a complete travel, adding itineraries and personnal notes to the map. When you travel is complete, you can save it to a file, export the itineraries to a gpx files, print the itineraries and a roadbook with the notes and itineraries description.
Stars: ✭ 31 (+0%)
Mutual labels:  map
Tile-Studio
Tile / Sprite / Map Editor
Stars: ✭ 59 (+90.32%)
Mutual labels:  map
AuthLogAttackMap
Tails the /var/log/auth.log, geolocates IPs found, and displays them on a web frontend.
Stars: ✭ 23 (-25.81%)
Mutual labels:  map
jsvectormap
A lightweight JavaScript library for creating interactive maps and pretty data visualization.
Stars: ✭ 163 (+425.81%)
Mutual labels:  map
mapchina
R Package of Geospatial Shapefile of China Administrative Divisions to the County/District-Level.
Stars: ✭ 60 (+93.55%)
Mutual labels:  map
Valheim-ServerSideMap
This plugin completely moves the explored map and created pins to the server. As clients explore, they will send their explored areas to the server who will then distribute it to all connected clients. When a client joins, the server will synchronize the currently explored areas to the client. Pins are shared as well but default to false and nee…
Stars: ✭ 32 (+3.23%)
Mutual labels:  map
planvelo-carte
Observatoire du Plan Vélo
Stars: ✭ 28 (-9.68%)
Mutual labels:  map
o.map
Open Street Map app - KaiOS
Stars: ✭ 51 (+64.52%)
Mutual labels:  map
vts-browser-cpp
VTS Browser C++ library
Stars: ✭ 45 (+45.16%)
Mutual labels:  map
PHPCoord
PHPCoord is a PHP library to aid in handling coordinates. It can convert coordinates for a point from one system to another and also calculate distance between points
Stars: ✭ 78 (+151.61%)
Mutual labels:  map
eurostat.js
Some reusable Javascript libraries for Eurostat data users and web developers
Stars: ✭ 30 (-3.23%)
Mutual labels:  map
leaflet heatmap
简单的可视化湖州通话数据 假设数据量很大,没法用浏览器直接绘制热力图,把绘制热力图这一步骤放到线下计算分析。使用Apache Spark并行计算数据之后,再使用Apache Spark绘制热力图,然后用leafletjs加载OpenStreetMap图层和热力图图层,以达到良好的交互效果。现在使用Apache Spark实现绘制,可能是Apache Spark不擅长这方面的计算或者是我没有设计好算法,并行计算的速度比不上单机计算。Apache Spark绘制热力图和计算代码在这 https://github.com/yuanzhaokang/ParallelizeHeatmap.git .
Stars: ✭ 13 (-58.06%)
Mutual labels:  map
symphony-of-empires
Symphony of the Empires is a RTS strategy game and map game.
Stars: ✭ 67 (+116.13%)
Mutual labels:  map
ProMotion-map
ProMotion::MapScreen gem. Extracted from ProMotion core.
Stars: ✭ 13 (-58.06%)
Mutual labels:  map

GoDoc Build Status Go Report Card Coverage Status License: MIT

Go-Multimap

This is the missing multimap collection for the Go language (also a simple practice in creating a proper library/package).

A multimap (sometimes also multihash or multidict) is a generalization of a map or associative array abstract data type in which more than one value may be associated with and returned for a given key.

Some use cases and examples for this data type includes:

  • The index of a book may report any number of references for a given index term, and thus may be coded as a multimap from index terms to any number of reference locations or pages.
  • Address location, such as ZIP code, that maps to any number of people living in that area.

There are two different multimap implementations, slicemultimap and setmultimap, which has slices and sets as the map values respectively. slicemultimap is useful when duplicate key/value pairs is allowed and insertion ordering is important. On the other hand, setmultimap is suitable when duplicates of key/value pairs are not allowed.

This package was heavily inspired by the Google Guava interface of MultiMap and written in the style of the container package.

References: Wikipedia, Guava

Installation

Install the package via the following:

go get -u github.com/jwangsadinata/go-multimap

Usage

The go-multimap package can be used similarly to the following:

// example/example.go
package main

import (
	"fmt"

	"github.com/jwangsadinata/go-multimap/slicemultimap"
)

func main() {
	usPresidents := []struct {
		firstName  string
		middleName string
		lastName   string
		termStart  int
		termEnd    int
	}{
		{"George", "", "Washington", 1789, 1797},
		{"John", "", "Adams", 1797, 1801},
		{"Thomas", "", "Jefferson", 1801, 1809},
		{"James", "", "Madison", 1809, 1817},
		{"James", "", "Monroe", 1817, 1825},
		{"John", "Quincy", "Adams", 1825, 1829},
		{"John", "", "Tyler", 1841, 1845},
		{"James", "", "Polk", 1845, 1849},
		{"Grover", "", "Cleveland", 1885, 1889},
		{"Benjamin", "", "Harrison", 1889, 1893},
		{"Grover", "", "Cleveland", 1893, 1897},
		{"George", "Herbert Walker", "Bush", 1989, 1993},
		{"George", "Walker", "Bush", 2001, 2009},
		{"Barack", "Hussein", "Obama", 2009, 2017},
	}

	m := slicemultimap.New()

	for _, president := range usPresidents {
		m.Put(president.firstName, president.lastName)
	}

	for _, firstName := range m.KeySet() {
		lastNames, _ := m.Get(firstName)
		fmt.Printf("%v: %v\n", firstName, lastNames)
	}
}

Example output:

$ go run example.go
George: [Washington Bush Bush]
John: [Adams Adams Tyler]
Thomas: [Jefferson]
James: [Madison Monroe Polk]
Grover: [Cleveland Cleveland]
Benjamin: [Harrison]
Barack: [Obama]

Benchmarks

To see the benchmark, run the following on each of the sub-packages:

go test -run=NO_TEST -bench . -benchmem -benchtime 1s ./...

Please see the GoDoc API page for a full API listing. For more examples, please consult example_test.go file located in each subpackages.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].