iterativeheaps.jl

Julia package for iterative heaps w/cache arrays, including for distribute

https://github.com/jcsyme/iterativeheaps.jl

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

Julia package for iterative heaps w/cache arrays, including for distribute

Basic Info
  • Host: GitHub
  • Owner: jcsyme
  • License: mit
  • Language: Julia
  • Default Branch: main
  • Size: 38.1 KB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created almost 2 years ago · Last pushed 10 months ago
Metadata Files
Readme License Citation

README.md

IterativeHeaps.jl

Julia package for iterative heaps w/cache arrays, including parallel heaps using DistributedArrays(). These heaps allow for multiple heaps to occur at the same time across a number of nodes while accessing a shared storage structure (DArray), which is convenient for memory and speed management when iterating in parallel.

Heaps sort (key, value) pairs (with respect to the value) continuously as new values are pushed to the heap; they do this efficiently, allowing for certain algorithms to be implemented much more quickly than they would otherwisae. For example, a fast heap is critical to a quick implementation of Dijkstra's shortest path algorithm.

Once pushed, users can efficienctly pop (sometimes referred to as dequeing) the next key/value pair associated with the next-lowest value. Heaps are particularly useful when values can be pushed an popped multiple times or when the values that are pushed are not known a priori (in which case sorting can be efficient).

Introduction

IterartiveHeaps.jl provides three key heap types:

  • KAryHeap: The KAryHeapis a generalization of the binary heap with k children (where zk = 2 is a binary heap); see Wikipedia for an explanation.
  • FibonacciHeap: See Princeton Computer Science (Wayne) for a psuedocode implementation of the §.
  • SimpleQueue: A simple queue does not implement sorting, instead allowing for integers to popped in the order they were pushed.

Use

Heaps are generally defined with a maximum size in IterativeHeaps.jl. In general, heaps can be modified using the

heap_push!(heap, k, v)

and

heap_pop!(heap)

operations. After pushing to heaps, heaps will dequeue in ascending order based on key values, returning the key and its associated value.

KaryHeap

The KaryHeap can be used to instantiate a heap where each parent has k children and a maximum heap size of max_size. Furthermore, heap arrays can be stored in an iterative context by passing the data, index, and/or index_lookup arguments. If included (recommended for iteration), these should be a vector of length max_size. If being used on computational nodes, they can be the column of a DistrubatedArrays.DArray.

The type T is the type of data stored in heap values, i.e., in vector data; therefore, if passing a vector as an argument for data, it should have element types T.

KaryHeap{T}( max_size::Int64, k::Int64; data::VMOrNoth{T} = nothing, index::VMOrNoth{Int64} = nothing, index_lookup::VMOrNoth{Int64} = nothing, )

BinaryHeap

The BinaryHeap is a shortcut for the KaryHeap where k = 2. Otherwise, instantiation arguments are the same.

KaryHeap{T}( max_size::Int64, k::Int64; data::VMOrNoth{T} = nothing, index::VMOrNoth{Int64} = nothing, index_lookup::VMOrNoth{Int64} = nothing, )

FibonacciHeap

The FibonacciHeap is a special heap that resorts on each pop! operation.

FibonacciHeap{U, T}( max_size::Int64; )

Data

The heaps do not require any data; instead, they are useful for many coding applications, where users can push a key/value pair to the heap (inline) and pop them in ascending order according to the value.

Project information

The authors are grateful to RAND Center for Global Risk and Security Advisory Board members Michael Munemann and Paul Cronson for funding this project. All code was developed between April 2023 and October 2024.

References/Bibliography

Kevin Wayne. 2024. Algorithm for Fibonacci Heap Operations (from CLR text). https://www.cs.princeton.edu/~wayne/cs423/fibonacci/FibonacciHeapAlgorithm.html

Daniel Borowski. fib-heap.py. https://github.com/danielborowski/fibonacci-heap-python/blob/master/fib-heap.py

Copyright and License

Copyright (C) <2024> RAND Corporation. This code is made available under the MIT license.

Authors and Reference

James Syme, 2024.

@misc{GDA2024, author = {Syme, James}, title = {IterativeHeaps.jl: Memory-efficient heaps for iteration and parallelization.}, year = 2024, url = {URLHERE} }

Owner

  • Login: jcsyme
  • Kind: user

Citation (CITATION.cff)

cff-version: 1.2.0
title: IterativeHeaps.jl
message: Suggested Citation
type: software
authors:
  - email: jsyme@rand.org
    given-names: James
    family-names: Syme
    affiliation: RAND
repository-code: >-
  MISSING
url: MISSING
abstract: >-
  Implementation of K-ary (arbitrary K) and fibonacci heaps for use in 
  distributed, iterative environments. Reduces memory leaks and pressure from
  excessive creation and destruction of Heaps by allowing heaps to access
  DistributedArrays.
license: MIT

GitHub Events

Total
  • Push event: 9
Last Year
  • Push event: 9