{"id":21230108,"url":"https://github.com/fgforrest/pmptt","last_synced_at":"2026-02-08T07:07:42.034Z","repository":{"id":40993837,"uuid":"305700764","full_name":"FgForrest/PMPTT","owner":"FgForrest","description":"PMPTT is a derivation of original Modified Preorder Tree Traversal algorithm that partially solves the problem of heavy write costs by pre allocating numeric range for the tree of the estimated size.","archived":false,"fork":false,"pushed_at":"2024-10-18T22:41:01.000Z","size":175,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-27T14:21:40.446Z","etag":null,"topics":["algorithm","hierarchy","java","mptt","tree"],"latest_commit_sha":null,"homepage":"https://edee.one","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FgForrest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-20T12:29:28.000Z","updated_at":"2024-10-04T06:48:17.000Z","dependencies_parsed_at":"2022-09-18T09:21:27.179Z","dependency_job_id":null,"html_url":"https://github.com/FgForrest/PMPTT","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FgForrest%2FPMPTT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FgForrest%2FPMPTT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FgForrest%2FPMPTT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FgForrest%2FPMPTT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FgForrest","download_url":"https://codeload.github.com/FgForrest/PMPTT/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799999,"owners_count":21163404,"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":["algorithm","hierarchy","java","mptt","tree"],"created_at":"2024-11-20T23:35:48.909Z","updated_at":"2026-02-08T07:07:41.936Z","avatar_url":"https://github.com/FgForrest.png","language":"Java","readme":"# Pre-allocated Modified Preorder Tree Traversal\n\n[MPTT](https://en.wikipedia.org/wiki/Tree_traversal) approach to tree structures simplifies the evaluation of parent \nand child relationship to two numbers comparation. One of the [Forrest guys](https://www.fg.cz/cs/forresti/tym/honza-10233)\nhas a lecture on this topic at [JavaDays 2020](https://javadays.cz/cs/) conference. Although it is a relatively old \nalgorithm, it has one key disadvantage and that is the high cost of writing a new item or moving it in the structure. \nThese operations typically involve the recalculation of a large part of the tree, and if these boundaries are stored \nelsewhere due to the greater performance of SQL queries, this disadvantage is further multiplied.\n\nFor this reason, we have come up with a small mutation in this algorithm (called Pre-allocated Modified Preorder Tree \nTraversal), which, while accepting certain simplifications, allows you to define an equation that determines boundaries \nfor each tree node so that write operations such as adding, removing or moving a node within the same superior node, \nwhich doesn't imply any boundary recalculation requirements at all.\n\nThe simplification to be undertaken is to define in advance the maximum number of levels of immersion in the tree, \nand the maximum number of children per node. At the same time, it is necessary to combine the data type long, which \nrepresents about 10 levels of the tree in depth with 55 items in one node.\n\nThe library also greatly simplifies the operations of moving nodes between different levels of the tree (including \nchild nodes), although these operations remain just as write-intensive as in the original algorithm.\n\nImplications of the PMPTT algorithm are summarized in this [presentation](http://bit.ly/javadays2020).\n\nFor more information see section [How to use](#how-to-use)\n\n## Prerequisites\n\n- JDK 1.8+\n- Commons Logging (1.2.0+)\n\n**RDBMS version:**\n\n- [Darwin library](https://github.com/FgForrest/Darwin)\n- Spring framework (5.3.0+), works also on 4.3.X older version although not compilable due to JUnit tests\n\n## Supported databases\n\n- MySQL\n- Oracle\n\nDo you missing one? Fill a pull request!\n\n## How to compile\n\nUse standard Maven 3 command:\n\n```\nmvn clean install\n```\n\n## How to run tests\n\nStart databases:\n\n```\ndocker-compose -f docker/docker-compose.yml up \n```\n\nRun your tests in IDE or run:\n\n```\nmvn clean test\n```\n\nHelp us maintain at least 80% code coverage!\n\n## How to use\n\nSee separate chapters for details:\n\n- [Theory behind](pmptt_core/src/main/resources/META-INF/pmptt/docs/theory.md)\n- [How to integrate to your application (memory version)](pmptt_core/src/main/resources/META-INF/pmptt/docs/how-to-integrate-memory.md)\n- [How to integrate to your application (RDBMS version)](pmptt_core/src/main/resources/META-INF/pmptt/docs/how-to-integrate-rdbms.md)\n- [How to create hierarchy](pmptt_core/src/main/resources/META-INF/pmptt/docs/how-to-create-hierarchy.md)\n- [How to query hierarchy](pmptt_core/src/main/resources/META-INF/pmptt/docs/how-to-query-hierarchy.md)\n- [How to propagate changes to a duplicated data](pmptt_core/src/main/resources/META-INF/pmptt/docs/how-to-propagate-changes.md)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgforrest%2Fpmptt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffgforrest%2Fpmptt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffgforrest%2Fpmptt/lists"}