{"id":15411641,"url":"https://github.com/dirkster99/treelib","last_synced_at":"2025-04-19T08:06:52.115Z","repository":{"id":85744178,"uuid":"106049781","full_name":"Dirkster99/TreeLib","owner":"Dirkster99","description":"A .Net Standard Library with Generic methods to traverse k-ary trees in any order required.","archived":false,"fork":false,"pushed_at":"2019-07-05T17:42:39.000Z","size":87,"stargazers_count":29,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-04T12:43:41.866Z","etag":null,"topics":["algorithms","breadth-first-search","depth-first-search","dotnet-standard","generic","generic-methods","graph-algorithms","ienumerable","ienumerable-extension","levelorder","postorder","preorder","traversal","traversal-methods","tree"],"latest_commit_sha":null,"homepage":"","language":"C#","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/Dirkster99.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-06T20:59:06.000Z","updated_at":"2025-01-13T07:27:07.000Z","dependencies_parsed_at":"2023-06-09T00:30:30.465Z","dependency_job_id":null,"html_url":"https://github.com/Dirkster99/TreeLib","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dirkster99%2FTreeLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dirkster99%2FTreeLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dirkster99%2FTreeLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Dirkster99%2FTreeLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Dirkster99","download_url":"https://codeload.github.com/Dirkster99/TreeLib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249191344,"owners_count":21227548,"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":["algorithms","breadth-first-search","depth-first-search","dotnet-standard","generic","generic-methods","graph-algorithms","ienumerable","ienumerable-extension","levelorder","postorder","preorder","traversal","traversal-methods","tree"],"created_at":"2024-10-01T16:49:47.216Z","updated_at":"2025-04-19T08:06:52.082Z","avatar_url":"https://github.com/Dirkster99.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build status](https://ci.appveyor.com/api/projects/status/de18xc6i431xnlvg?svg=true)](https://ci.appveyor.com/project/Dirkster99/treelib)\n[![Release](https://img.shields.io/github/release/Dirkster99/TreeLib.svg)](https://github.com/Dirkster99/TreeLib/releases/latest)\n[![NuGet](https://img.shields.io/nuget/dt/Dirkster.TreeLib.svg)](http://nuget.org/packages/Dirkster.TreeLib)\n\n# TreeLib\nThis project provides a:\n- \u003ca href=\"https://docs.microsoft.com/en-us/dotnet/standard/net-standard\"\u003e.Net Standard\u003c/a\u003e Library (1.4, 1.6, 2.0) or a\n- .Net framework 4.0 Library\n\nwith Generic methods to traverse k-ary trees in different orders (Post-Order, Pre-Order, Level-Order) of traversal. This implementation includes scalable algorithms that return `IEnumerable\u003cT\u003e` to make parsing large tree structures a piece of cake, as well, as [Generic Exception handling](https://github.com/Dirkster99/TreeLib/blob/adb9145b9c5baaf0ee8bd6f5fe5982354d962dc2/source/TreeLibNugetDemo/Demos/Directories/DirectorySize.cs#L85-#L86) to ensure that traversal algorithms complete despite unexpected errors on some nodes.\n\nReview demo projects:\n* in this solution,\n* \u003ca href=\"https://github.com/Dirkster99/FilterTreeView\"\u003eWPF FilterTreeView\u003c/a\u003e sample application, and read\n* \u003ca href=\"https://www.codeproject.com/Articles/1213031/Advanced-WPF-TreeViews-Part-of-n\"\u003eAdvanced WPF TreeViews Part 3 of n\u003c/a\u003e\n* \u003ca href=\"https://www.codeproject.com/Articles/1216583/Advanced-WPF-TreeViews-Part-of-n\"\u003eAdvanced WPF TreeViews Part 4 of n\u003c/a\u003e to learn more details.\n\nImplementing something as complicated as a Post-Order traversal algorithm requires just:\n* a project reference,\n* a \u003ca href=\"https://msdn.microsoft.com/en-us/library/bb308959.aspx\"\u003eLINQ\u003c/a\u003e statement to find each set of children in the tree,\n* and a simple for each loop to implement the operation on each tree node:\n\n```C#\nConsole.WriteLine(\"(Depth First) PostOrder Tree Traversal V3\");\nitems = TreeLib.Depthfirst.Traverse.PostOrder(root, i =\u003e i.Children);\n\nforeach (var item in items)\n{\n  Console.WriteLine(item.GetPath());\n}\n```\nThis pattern leads to a clear-cut separation of:\n* the traversal algorithm and\n* the operations performed on each tree node (e.g.: `Console.WriteLine(item.GetPath());`).\n\nThe project in this repository contains a demo console project to demo its usage in more detail.\n\n# Supported Generic Traversal Methods\n\n## Breadth First\n### Level Order\nSee TreeLib.BreadthFirst.Traverse.LevelOrder implementation for:\n\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/BreadthFirst/TraverseLevelOrder.cs\"\u003eTrees with 1 root node\u003c/a\u003e (expects 1 \u0026lt;T\u0026gt; root item as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/BreadthFirst/TraverseLevelOrderEnumerableRoot.cs\"\u003eTrees with multiple root nodes\u003c/a\u003e (expects an IEnumerable\u0026lt;T\u0026gt; root item as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/BreadthFirst/LevelOrder.cs\"\u003eGeneric Level-Order\u003c/a\u003e function and \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/TreeLibNugetDemo/Program.cs\"\u003eDemoDirectoryTreeTraversal\u003c/a\u003e\n\n## Depth First\n### PreOrder\nSee TreeLib.BreadthFirst.Traverse.PreOrder implementation for:\n\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/TraversePreorder.cs\"\u003eTrees with 1 root node\u003c/a\u003e (expects 1 \u0026lt;T\u003e root item as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/TraversePreorderEnumerableRoot.cs\"\u003eTrees with multiple root nodes\u003c/a\u003e (expects IEnumerable\u0026lt;T\u003e root as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/PreOrder.cs\"\u003eGeneric Pre-Order\u003c/a\u003e function and \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/TreeLibNugetDemo/Program.cs\"\u003eDemoDirectoryTreeTraversal\u003c/a\u003e\n\n### Postorder\nSee TreeLib.BreadthFirst.Traverse.Postorder implementation for:\n\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/TraversePostOrder.cs\"\u003eTrees with 1 root node\u003c/a\u003e (expects 1 \u0026lt;T\u003e root item as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/TraversePostOrderEnumerableRoot.cs\"\u003eTrees with multiple root nodes\u003c/a\u003e (expects IEnumerable\u0026lt;T\u003e root item as parameter)\n* \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/Shared/Depthfirst/PostOrder.cs\"\u003eGeneric Post-Order\u003c/a\u003e function and \u003ca href=\"https://github.com/Dirkster99/TreeLib/blob/master/source/TreeLibNugetDemo/Program.cs\"\u003eDemoDirectoryTreeTraversal\u003c/a\u003e\n\n# Tip\n* Read about [Generic Tree and Linked List Traversal in C#](http://web.archive.org/web/20180128233111/http://www.codeducky.org/easy-tree-and-linked-list-traversal-in-c/) to understand the usefulness of *Generic* traversal methods.\n\n* Watch the \u003ca href=\"https://www.youtube.com/watch?v=gm8DUJJhmY4\"\u003eBinary tree traversal: Preorder, Inorder, Postorder\u003c/a\u003e video to better understand what is what (and why these Traversal Order Names make some sense):\n\n* Look into data structure books online [Introduction to Trees, Binary Search Trees](https://cathyatseneca.gitbooks.io/data-structures-and-algorithms/introduction_to_trees,_binary_search_trees/definitions.html) or offline *[Algorithms](http://algs4.cs.princeton.edu/home/)* by Robert Sedgewick and Kevin Wayne, if you still need more background on tree structures \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkster99%2Ftreelib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirkster99%2Ftreelib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirkster99%2Ftreelib/lists"}