{"id":18449890,"url":"https://github.com/aleksandrhovhannisyan/pythongraphcycledetection","last_synced_at":"2025-04-18T00:20:05.213Z","repository":{"id":115671646,"uuid":"159822642","full_name":"AleksandrHovhannisyan/PythonGraphCycleDetection","owner":"AleksandrHovhannisyan","description":"Python script for detecting cycles in a directed graph.","archived":false,"fork":false,"pushed_at":"2019-05-31T18:57:11.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T22:59:54.668Z","etag":null,"topics":["algorithm","cycle-detection","deadlock-detection","detecting-cycles","graphs","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AleksandrHovhannisyan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-11-30T12:47:44.000Z","updated_at":"2019-07-06T18:03:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b1adf33-2a70-4276-aa3e-18851a911717","html_url":"https://github.com/AleksandrHovhannisyan/PythonGraphCycleDetection","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksandrHovhannisyan%2FPythonGraphCycleDetection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksandrHovhannisyan%2FPythonGraphCycleDetection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksandrHovhannisyan%2FPythonGraphCycleDetection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AleksandrHovhannisyan%2FPythonGraphCycleDetection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AleksandrHovhannisyan","download_url":"https://codeload.github.com/AleksandrHovhannisyan/PythonGraphCycleDetection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249167442,"owners_count":21223505,"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","cycle-detection","deadlock-detection","detecting-cycles","graphs","python"],"created_at":"2024-11-06T07:22:33.783Z","updated_at":"2025-04-15T22:59:57.738Z","avatar_url":"https://github.com/AleksandrHovhannisyan.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Graph Cycle Detection\r\n\r\nA simple Python program to detect cycles in a directed graph. Below is a sample image of the graph used for testing [source: Modern Operating Systems, 4th ed]. The left image shows the original nodes in the graph. The right image shows the reduced graph with all identified cycles.\r\n\r\n![Image of a graph from Modern Operating Systems, Chapter 6](graph.PNG)\r\n\r\n### Using the Class\r\n\r\nThe `CycleFinder` class expects to be fed an instance of `DirectedGraph` (see `graph.py`).\r\n\r\nThis class accepts a dictionary that maps a node to its neighbors. Optionally, you can avoid initializing it with any dictionary and manually `insert` your nodes into the graph.\r\n\r\nYou'll need the following imports:\r\n\r\n`from cycle_finder import CycleFinder`\r\n\r\n`from graph import DirectedGraph`\r\n\r\n### Testing\r\n\r\nSee the bottom of `cycle_finder.py` for an example test to identify the cycle in the image above. Note that CycleFinder *will* modify the underlying dictionary once the `findCycles` method is invoked.\r\n\r\nNote: If a node does not have any edges originating from it (such as `S` in the sample image provided above), do one of the following:\r\n\r\n- If you're initializing a `DirectedGraph` object with a dictionary, then specify that node's neighbors as the empty list (`[]`)\r\n- If you're instead manually inserting start-end pairs, then specify `end` as `None`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksandrhovhannisyan%2Fpythongraphcycledetection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleksandrhovhannisyan%2Fpythongraphcycledetection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleksandrhovhannisyan%2Fpythongraphcycledetection/lists"}