{"id":16342618,"url":"https://github.com/adithyaov/acyclic-graphs","last_synced_at":"2025-11-05T13:30:32.561Z","repository":{"id":76649502,"uuid":"175500267","full_name":"adithyaov/acyclic-graphs","owner":"adithyaov","description":"A small experiment to make acyclic graphs in Haskell.","archived":false,"fork":false,"pushed_at":"2019-04-18T06:49:45.000Z","size":32,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-27T13:25:03.378Z","etag":null,"topics":["acyclic","alga","haskell"],"latest_commit_sha":null,"homepage":null,"language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adithyaov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2019-03-13T21:15:52.000Z","updated_at":"2020-01-20T08:54:19.000Z","dependencies_parsed_at":"2023-04-01T15:33:16.939Z","dependency_job_id":null,"html_url":"https://github.com/adithyaov/acyclic-graphs","commit_stats":{"total_commits":27,"total_committers":1,"mean_commits":27.0,"dds":0.0,"last_synced_commit":"7393fe8b1b204b2a829ef3604843be070e1e01a2"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithyaov%2Facyclic-graphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithyaov%2Facyclic-graphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithyaov%2Facyclic-graphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adithyaov%2Facyclic-graphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adithyaov","download_url":"https://codeload.github.com/adithyaov/acyclic-graphs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239460735,"owners_count":19642456,"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":["acyclic","alga","haskell"],"created_at":"2024-10-11T00:03:06.263Z","updated_at":"2025-11-05T13:30:32.508Z","avatar_url":"https://github.com/adithyaov.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extending Alga - Acyclic Graphs\n\n### Monadic representation of Acyclic Graphs (implementation 2)\nThis is a very simple yet effective implementation of acyclic graphs using Monads.\n\n3 important functions,\n\n`dag :: State DAG' -\u003e DAG`\n\n`singleton :: State DAG' DAG'`\n\n`edgeTo :: [DAG'] -\u003e State DAG' DAG'`\n\nHow should you read `DAG' v [e1, e2] d`?\n\n`DAG' v [e1, e2] d` is a directed acyclic graph where the vertex identified by `v` has its edges to `e1` and `e2` where `e1` and `e2` are defined in `d`. One can further go through `d` the same way.\n\nWe build the acyclic graph incrementally.\n\n### Representation of Acyclic Graphs\n\nPlease go through the [Alga paper](https://dl.acm.org/authorize?N46678) before proceeding as some of the terminology used is taken from the paper.\n\nThe acyclic graph has a very simple representation which requires the vertices to have an order defined on them.\n\nConsider a set of graphs in which edges only exist from a lower ordered vertex to a higher ordered vertex. It is evident that no graph in this set has any cycle.\n\nNow consider two operations on the set, `*` and `+` (connect and overlay),  \n`+` has the same properties as mentioned in the paper  \n`*` is slightly different, for any two acyclic graphs in the set, `g1 (v1, e1)` and `g2 (v2, e2)`, `g1 * g2 = g3 (v3, e3)` where `v3 = v1 *union* v2 and e3 = e1 *union* e2 *union* [(x, y) where y \u003e x, x *belongs to* v1 and y *belongs to* v2]`  \nBasically `g1 * g2` connects all the lower vertices in `g1` to higher counterparts in `g2`.\nNote that this representation is algebrically anologous to a semi-ring.\n\n### Modules and important functions/classes\n\n#### module General.Graph\n\nThis module contains classes and a default instance of that class to represent a graph.\n\n1. **class Graph**\n    - This class is similar to one defined in the paper with an added function signature, `adjMap :: Map (Vertex g) [Vertex g]`. This is a simple canonical representation of a graph.\n\n2. **data Relation**\n    - This is similar to the `Relation` data type defined in the paper. A simple representation of a graph for this prototype.\n\n#### module Acyclic.Graph\n\nThe most important module :-). This module contains the type `AcyclicRelation` which is the acyclic extension of the `Relation` data type defined in the paper.\n\n1. **data AcyclicRelation**\n    - This is an extension of the `Relation` data type which filters the improper edges in the `*` operation.\n\n2. **unsafeConvertToAcyclic**\n    - This function converts any type that has an instance of `Graph` to a graph of Acyclic type.\n    - This is the most general type of transformation where one constructs the acyclic graph, but if the underlying type is known then one can create a faster transformation method.\n    - This function, if implemented in the Alga library, should not be exported as humans can do all kind of crazy things.\n    - Any function that results in an acyclic computation should be chained with this function to result in a graph which has the Acyclic type. For example, `scc' = unsafeConvertToAcyclic . scc`. `scc'` now returns a graph of Acyclic type.\n    - This function topologically sorts the vertices, applies the new order and reconstructs the graph (Acyclic fashion).\n\n#### module Acyclic.Util\n\nUtility function for describing acyclic graphs, to be used in Acyclic.Graph.\n\n1. **newtype SimpleOrder**\n    - This is important to enforce a new order on already defined vertices.\n    - This is a required type as any general graph, even though acyclic need not follow the property mentioned (edges from lower to higher order) and enforcing a strict usage of that property on a user is undesirable.\n\n#### module Prototype\n\nThis is a simple prototype to show functionality. \n\n1. **graph**\n    - This is treated as the result of an `scc` operation of the following graph, `A * B + B * D + D * B + D * C`. `B` and `D` form a strongly connected component and the the result of the scc is the following graph, `[[A], []] * [[B, D], [(B, D), (D, B)]] + [[B, D], [(B, D), (D, B)]] * [[C], []]` (Note that the vertices of the new graph are graphs).\n\n2. **acyclicGraph**\n    - This is the result of applying `unsafeConvertToAcyclic` to `graph`.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadithyaov%2Facyclic-graphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadithyaov%2Facyclic-graphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadithyaov%2Facyclic-graphs/lists"}