{"id":16216010,"url":"https://github.com/kc596/ugcpriorityqueue","last_synced_at":"2025-04-02T12:25:09.147Z","repository":{"id":57550742,"uuid":"308918677","full_name":"kc596/UGCPriorityQueue","owner":"kc596","description":"Unbuffered Generic Concurrent Priority Queue in GoLang.","archived":false,"fork":false,"pushed_at":"2020-11-03T13:50:14.000Z","size":23,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T03:28:04.493Z","etag":null,"topics":["go","golang","priority-queue","priorityqueue","priorityqueues"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kc596.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-31T16:00:47.000Z","updated_at":"2021-01-15T12:58:20.000Z","dependencies_parsed_at":"2022-09-26T18:41:51.774Z","dependency_job_id":null,"html_url":"https://github.com/kc596/UGCPriorityQueue","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kc596%2FUGCPriorityQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kc596%2FUGCPriorityQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kc596%2FUGCPriorityQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kc596%2FUGCPriorityQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kc596","download_url":"https://codeload.github.com/kc596/UGCPriorityQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246813110,"owners_count":20838053,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","priority-queue","priorityqueue","priorityqueues"],"created_at":"2024-10-10T11:17:41.824Z","updated_at":"2025-04-02T12:25:09.123Z","avatar_url":"https://github.com/kc596.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## UGC Priority Queue\n\n[![Build Status](https://travis-ci.org/kc596/UGCPriorityQueue.svg?branch=master)](https://travis-ci.org/kc596/UGCPriorityQueue)\n[![codecov](https://codecov.io/gh/kc596/UGCPriorityQueue/branch/master/graph/badge.svg?token=80KG51HA2Z)](https://codecov.io/gh/kc596/UGCPriorityQueue/branch/master/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kc596/UGCPriorityQueue)](https://goreportcard.com/report/github.com/kc596/UGCPriorityQueue)\n\n\n**U**nbuffered **G**eneric **C**oncurrent Priority Queue in GoLang.\n\n### Installation\n\n\u003e go get github.com/kc596/UGCPriorityQueue\n\n### Quickstart\n\n```go\nimport (\n\t\"github.com/kc596/UGCPriorityQueue/maxpq\"\n\t\"fmt\"\n)\n\nfunc ExamplePQ() {\n\t// create new max priority queue\n\tpq := maxpq.New()\n    \n\t// creating new pq node with priority 1\n\tnode1 := maxpq.NewNode(\"Value1\", 1)\n    \n\t// value of node could be of any type, int here\n\tnode2 := maxpq.NewNode(101, 10)\n    \n\t// add the nodes to pq\n\tpq.Insert(node1)\n\tpq.Insert(node2)\n    \n\t// get the node with highest priority\n\thighestPriorityNode, _ := pq.Max()\n\tfmt.Printf(\"%+v\\n\", highestPriorityNode)\n    \n\t// pop the nodes with highest priority\n\thighestPriorityNode, _ = pq.Pop()\n\tnextHighest, _ := pq.Pop()\n\tfmt.Printf(\"%+v\\n\", highestPriorityNode) // value:101, priority:10\n\tfmt.Printf(\"%+v\\n\", nextHighest)         // value:Value1, priority:1\n}\n```\n\n### APIs\n\n#### maxpq.PQ\nMethod | Return Type | Description\n---|---|---\n`IsEmpty()`|`bool` | Returns true if there are no nodes in priority queue\n`Size()` | `int` | Returns the number of nodes in priority queue\n`Insert(*Node)` | `void` | Adds a new node to the priority queue\n`Max()` | `*Node,error` | Returns highest priority node of the priority queue\n`Pop()` | `*Node,error` | Returns highest priority node and deletes it from priority queue\n`Clear()` | `void` | Clears the priority queue\n\n\n#### maxpq.Node\nMethod | Return Type\n---|---\n`GetPriority()`|`float64`\n`GetStringValue()` | `string`\n`GetFloat64Value()` | `float64` \n`GetFloat32Value()`| `float32`\n`GetIntValue()`| `int`\n`GetInt64Value()`| `int64`\n`GetInt32Value()`| `int32`\n`GetUIntValue()`| `uint`\n`GetUInt64Value()`| `uint64`\n`GetUInt32Value()`| `uint32`\n`GetFuncValue()`| `func()`\n`GetValue(target interface{})` | `void`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkc596%2Fugcpriorityqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkc596%2Fugcpriorityqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkc596%2Fugcpriorityqueue/lists"}