{"id":15718928,"url":"https://github.com/ayaankhan98/algorithms-on-graphs","last_synced_at":"2025-08-01T06:14:57.047Z","repository":{"id":120533086,"uuid":"259412084","full_name":"ayaankhan98/Algorithms-on-graphs","owner":"ayaankhan98","description":"Self Learning Repository For Graph Algorithms","archived":false,"fork":false,"pushed_at":"2020-07-13T13:20:40.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-10T10:16:11.182Z","etag":null,"topics":["graph","graph-algorithms","maze"],"latest_commit_sha":null,"homepage":null,"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/ayaankhan98.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":"2020-04-27T18:04:31.000Z","updated_at":"2020-07-13T20:53:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"725a8a34-7a99-4567-a4e7-e14bb6a0631e","html_url":"https://github.com/ayaankhan98/Algorithms-on-graphs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ayaankhan98/Algorithms-on-graphs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayaankhan98%2FAlgorithms-on-graphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayaankhan98%2FAlgorithms-on-graphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayaankhan98%2FAlgorithms-on-graphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayaankhan98%2FAlgorithms-on-graphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ayaankhan98","download_url":"https://codeload.github.com/ayaankhan98/Algorithms-on-graphs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ayaankhan98%2FAlgorithms-on-graphs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268177897,"owners_count":24208397,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["graph","graph-algorithms","maze"],"created_at":"2024-10-03T21:54:20.582Z","updated_at":"2025-08-01T06:14:57.025Z","avatar_url":"https://github.com/ayaankhan98.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algorithms-on-graphs\nSelf Learning Repository For Graph Algorithms\n\n- will be soon updating the repository it is completely up to date.\n- watch the repository for further updates\n- documentation is also poor, trying to fix this soon\n\n# Representation Of Graphs In Above Files\nIn programming assignments, graphs are given as follows. The first line contains non-negative integers n and\nm — the number of vertices and the number of edges respectively. The vertices are always numbered from 1\nto n. Each of the following m lines defines an edge in the format u v where 1 ≤ u, v ≤ n are endpoints of\nthe edge. If the problem deals with an undirected graph this defines an undirected edge between u and v. In\ncase of a directed graph this defines a directed edge from u to v. If the problem deals with a weighted graph\nthen each edge is given as u v w where u and v are vertices and w is a weight.\nIt is guaranteed that a given graph is simple. That is, it does not contain self-loops (edges going from a\nvertex to itself) and parallel edges.\n\nExamples:\n- An undirected graph with four vertices and five edges:\n```\n4 2\n4 1\n2 3\n5 1\n3 4\n4 2\n```\n- A directed graph with five vertices and eight edges.\n```\n5 8\n4 3\n1 2\n3 1\n3 4\n2 5\n5 1\n5 4\n5 3\n```\n\n- A directed graph with five vertices and one edge.\n```\n5 1\n4 3\n```\nNote that the vertices 1, 2, and 5 are isolated (have no adjacent edges), but they are still present in\nthe graph.\n\n- A weighted directed graph with three vertices and three edges.\n```\n3 3\n2 3 9\n1 3 5\n1 2 -2\n```\n\n# Problem : Finding an Exit from a Maze\n## Problem Introduction\nA maze is a rectangular grid of cells with walls between some of adjacent cells.\nYou would like to check whether there is a path from a given cell to a given\nexit from a maze where an exit is also a cell that lies on the border of the maze\n(in the example shown to the right there are two exits: one on the left border\nand one on the right border). For this, you represent the maze as an undirected\ngraph: vertices of the graph are cells of the maze, two vertices are connected by\nan undirected edge if they are adjacent and there is no wall between them. Then,\nto check whether there is a path between two given cells in the maze, it suffices to\ncheck that there is a path between the corresponding two vertices in the graph.\n\n## Problem Description\n### Task\nGiven an undirected graph and two distinct vertices u and v, check if there is a path between u and v.\n### Input Format\nAn undirected graph with n vertices and m edges. The next line contains two vertices u\nand v of the graph.\n### Constraints\n```\n2 ≤ n ≤ 10 3 ; 1 ≤ m ≤ 10 3 ; 1 ≤ u, v ≤ n; u != v.\n```\n### Output Format\nOutput 1 if there is a path between u and v and 0 otherwise.\n### Time Limits\n```\nLanguage    C | C++ | Java | Python  |  C#  |  Haskell | JavaScript |  Ruby |  Scala |\n--------------------------------------------------------------------------------------\nTime        1 |  1  |  1.5 |    5    |  1.5 |   2      |      5     |    5  |  5     |\n```\n### Solution\nreachability.cpp","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayaankhan98%2Falgorithms-on-graphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayaankhan98%2Falgorithms-on-graphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayaankhan98%2Falgorithms-on-graphs/lists"}