Skip to content
1 juin 2025

Lazarus Components

Watch Online
  • Home
  • 2020
  • septembre
  • 27
  • LGenerics

https://github.com/avk959/LGenerics


https://forum.lazarus.freepascal.org/index.php/topic,44140.0.html


  • Math

LGenerics

Matthius 27 septembre 2020 3 min read

Collection of generic algorithms and data structures entirely written in/for FPC and Lazarus. Started as a self-education project, it now seems quite comfortable and fast. In order to use it (FPC 3.2 and higher and Lazarus 1.9.0 and higher):

  • open and compile package lgenerics/LGenerics.lpk.

  • add LGenerics package to project dependencies.

 

Implemented primitives:

  • stack(unit LGStack)
  • queue(unit LGQueue)
  • deque(unit LGDeque)
  • vector(unit LGVector)
  • vector of bits(unit LGVector)
  • priority queue based on binary heap(unit LGPriorityQueue)
  • priority queue with key update and melding based on pairing heap(unit LGPriorityQueue)
  • sorted list(unit LGList)
  • hashed list – array based list with the ability to fast search by key(unit LGList)
  • hashset(unit LGHashSet)
  • fine-grained concurrent hashset(unit LGHashSet)
  • sorted set(unit LGTreeSet)
  • set of arbitrary size(unit LGUtil, TGSet)
  • hash multiset(unit LGHashMultiSet)
  • fine-grained concurrent hashmultiset(unit LGHashMultiSet)
  • sorted multiset(unit LGTreeMultiSet)
  • hashmap(unit LGHashMap)
  • fine-grained concurrent hashmap(unit LGHashMap)
  • sorted map(unit LGTreeMap)
  • hash multimap(unit LGMultiMap)
  • tree multimap(unit LGMultiMap)
  • list miltimap(unit LGMultiMap)
  • bijective map(unit LGBiMap)
  • sparse 2D table(unit LGTable2D)
  • disjoint set(unit LGHashSet)
  • AVL tree(unit LGAvlTree)
  • red-black tree(unit LGRbTree)
  • some treap variants(unit LGTreap)
  • general rooted tree(unit LGRootTree)
  • sparse labeled undirected graph(unit LGSimpleGraph)
  • sparse labeled directed graph(unit LGSimpleDigraph)

features:

  • extended IEnumearble interface – filtering, mapping, etc.
  • lite containers based on advanced records

 

Implemented graph features:

  • core functions:
    • vertices/edges addition/removal/query/enumeration, edge contraction, degree
    • load/save to own binary format, primitive export to DOT format
  • connectivity:
    • connected/strongly connected components, bipartite detection, degeneracy, k-core
    • articulation points, bridges, biconnected components
    • edge-connectivity
  • traversals:
    • BFS/DFS traversals with visitors,
    • cycle/negative cycle detection,
    • topological sort
  • operations:
    • induced subgraphs, complement, reverse, union, intersect, symmetric difference,
  • chordality testing
  • planarity testing: FMR Left-Right Planarity algorithm
  • distance within graph:
    • eccentricity, radius, diameter, center, periphery
  • matching:
    • maximum cardinality matching on bipartite/arbitrary graphs
    • minimum/maximum weight matching on bipartite graphs
  • dominators in flowgraps: simple iterative and Semi-NCA algorithms
  • some suggestions for NP-hard problems:
    • maximum independent set, maximal independent sets enumeration
    • maximum clique, cliques enumeration
    • minimum vertex cover, minimal vertex covers enumeration
    • vertex coloring, approximations and exact
    • minimum dominating set
    • Hamiltonian cycles and paths
    • local search TSP approximations, BnB TSP solver
  • minimum spanning trees: Prims’s and Kruskal’s algorithms
  • single source shortest paths:
    • Dijkstra with pairing heap, A*, Bellman-Ford-Moor with Tarjan’s subtree disassembly(BFMT)
  • all pairs shortest paths:
    • Floyd–Warshall, Johnson, BFMT
  • networks:
    • maximum flow: push/relabel, capacity scaling Dinitz
    • minimum-cost flow: Busacker-Gowen, cost scaling push/relabel algorithm
    • global minimum cut: Stoer–Wagner, Nagamochi-Ibaraki

 

Algorithms on arrays and vectors(mostly unit LGArrayHelpers):

  • reverse, right/left cyclic shifts
  • permutations
  • binary search
  • N-th order statistics
  • inversion counting
  • distinct values selection
  • quicksort
  • introsort
  • dual pivot quicksort
  • mergesort
  • timsort(unit LGMiscUtils)
  • counting sort
  • translation of Orson Peters’ PDQSort algorithm
  • static segment tree
  • …

 

Other:

  • non-cryptogarphic hashes(unit LGHash):
    • Yann Collet’s xxHash32, xxHash64
    • Austin Appleby’s MurmurHash2, MurmurHash2A, MurmurHash3_x86_32, MurmurHash64A
  • brief and dirty implementation of futures concept(unit LGAsync)
  • brief channel implementation(unit LGAsync)
  • brief implementation of thread pool(unit LGAsync)
  • 128-bit integers(unit LGInt128)

French

Collection d’algorithmes.

Continue Reading

Previous: LMath
Next: Pascal libraries for maths and statistics

Related Stories

Rozeta
1 min read
  • Math
Rozeta is a program that plots rose diagrams. A rose diagram is a circular histogram that shows...
Read More
LazMer
1 min read
  • Math
A package of components for measurement and automation in Lazarus.   French   Un paquet de composants...
Read More
128 bits Floats
1 min read
  • Math
NUTS – Numerical Tools – is a library of fixed size numbers written for the 64-bit Free...
Read More

Articles récents

  • Intraweb for Lazarus
  • LazTTF2Vector
  • NTSC/CRT port
  • Ghostscript-API-Wrapper
  • AVIF and HEIC Images

Commentaires récents

Aucun commentaire à afficher.

Archives

  • avril 2025
  • mars 2025
  • février 2025
  • janvier 2025
  • décembre 2024
  • août 2024
  • juin 2024
  • avril 2024
  • mars 2024
  • mai 2023
  • avril 2023
  • janvier 2023
  • décembre 2022
  • novembre 2022
  • août 2022
  • juin 2022
  • décembre 2021
  • novembre 2021
  • octobre 2021
  • septembre 2021
  • juillet 2021
  • mai 2021
  • avril 2021
  • mars 2021
  • janvier 2021
  • décembre 2020
  • novembre 2020
  • octobre 2020
  • septembre 2020
  • août 2020
  • mai 2020
  • novembre 2019
  • mai 2019
  • janvier 2019
  • octobre 2018
  • septembre 2018
  • juillet 2018
  • juin 2018
  • mai 2018
  • avril 2018
  • novembre 2017
  • septembre 2017
  • juillet 2017
  • mai 2017
  • mars 2017
  • janvier 2017
  • décembre 2016
  • septembre 2016
  • juillet 2016
  • juin 2016
  • septembre 2013
  • août 2013
  • juillet 2013
  • avril 2013
  • mars 2013
  • février 2013
  • janvier 2013
  • novembre 2012
  • octobre 2012
  • septembre 2012
  • août 2012
  • juillet 2012
  • juin 2012
  • avril 2012
  • mars 2012
  • février 2012
  • janvier 2012
  • décembre 2011
  • novembre 2011
  • octobre 2011
  • août 2011
  • juillet 2011
  • juin 2011
  • mai 2011
  • avril 2011
  • mars 2011
  • février 2011
  • janvier 2011
  • décembre 2010
  • novembre 2010
  • octobre 2010
  • septembre 2010
  • août 2010
  • juillet 2010
  • juin 2010
  • mai 2010
  • mars 2010
  • février 2010
  • janvier 2010
  • décembre 2009
  • novembre 2009
  • septembre 2009
  • août 2009
  • juillet 2009
  • juin 2009
  • avril 2009
  • mars 2009
  • janvier 2009
  • décembre 2008
  • novembre 2008
  • septembre 2008
  • juillet 2008
  • mai 2008
  • février 2008
  • janvier 2008

Catégories

  • 3D
  • 3D
  • 3D and 2D, Games
  • Applications
  • Audio
  • Bar/QR Codes
  • Buttons
  • Colors
  • Compilers
  • Components with sources
  • Components without sources
  • Compressing
  • Compressing
  • Crypting
  • Crypting
  • Data/Persistence
  • Data/Persistence
  • Data/Persistence
  • Demos and restrictions
  • Demos, applications, forms, themes, languages
  • DLL
  • DLL
  • Documents
  • Drivers
  • Editing
  • Education
  • Education
  • Emulation
  • Emulation
  • Exemple
  • File Systems
  • File Systems
  • File, Systems
  • Files and bases
  • Files and bases
  • Firewall
  • For Android
  • For Lazarus
  • For Lazarus
  • Forms
  • Forms
  • Fun, graphics, charts
  • Fun, graphics, charts
  • Games
  • Games
  • Genealogy
  • Graphics
  • Graphics and Charts
  • Graphs and stats
  • Hardware
  • Hardware
  • Hardware, sound, video, system, network
  • Hardware, sound, video, system, network
  • HTML/XML
  • HTML/XML
  • Images
  • Installing
  • Languages
  • Languages
  • LAZARUS
  • Log and tests
  • Mail
  • Management
  • Maps
  • Math
  • Math
  • Menus
  • Network
  • Network
  • Network
  • Network
  • Neural Networks and AI
  • Neural Networks and AI
  • Office
  • OS
  • Packaging
  • Panels
  • Players
  • Professions
  • Professions
  • Programming
  • Programming
  • Programming
  • Projects with sources and components
  • Projects without sources
  • Recognition
  • Reports
  • RSS
  • Science/Industry
  • Science/Industry
  • Scripts
  • Searching
  • Security
  • Security
  • Servers
  • Sound
  • Sound
  • Suite
  • System
  • Teaching
  • Teaching
  • Testing
  • Testing
  • Text
  • Text
  • Text, reports
  • Text/Recognition
  • Themes
  • Threading
  • Timers
  • Tools
  • Tools
  • Trees
  • Vectors
  • Video
  • Videos
  • Videos
  • Visual Components
  • Visual Components
  • Web
  • Web
  • Web, XML
  • Web, XML
  • Word processing
  • XML/HTML
  • XML/HTML

You may have missed

Intraweb for Lazarus
1 min read
  • HTML/XML
Web components IntraWeb 16 requires a license key version 11 (starts with +0011, the same used in...
Read More
LazTTF2Vector
1 min read
  • Graphics
This program reads TrueType font files and displays the entered text using CADSys4. The result can be...
Read More
NTSC/CRT port
1 min read
  • Exemple
  • Video
Integer-only NTSC video signal encoding/decoding emulation, originally by EMMIR.Also does VHS simulation.A rather straight port from C,...
Read More
Ghostscript-API-Wrapper
1 min read
  • Exemple
  • File, Systems
  • Graphics and Charts
  • Hardware
The Ghostscript-API-Wrapper is an open source project, that simplify use of Ghostscript for Delphi and Free Pascal....
Read More
Copyright © All rights reserved. | darklinks by AF themes.