{"id":20409675,"url":"https://github.com/sleekpanther/graph-strong-connectivity","last_synced_at":"2026-04-21T13:04:53.447Z","repository":{"id":115108650,"uuid":"98693271","full_name":"SleekPanther/graph-strong-connectivity","owner":"SleekPanther","description":"Application of Breadth-First Search to see if a directed graph is Strongly Connected","archived":false,"fork":false,"pushed_at":"2017-07-30T15:00:46.000Z","size":174,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-06T14:24:16.614Z","etag":null,"topics":["algorithm-design","bfs","breadth-first-search","directed","directed-edge","directed-graph","edge","graph-algorithms","graphs","noah","noah-patullo","noahpatullo","pattullo","pattulo","patullo","patulo","strong-connectivity","strongly","strongly-connected","strongly-connected-components"],"latest_commit_sha":null,"homepage":"","language":"Java","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/SleekPanther.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":"2017-07-28T22:39:21.000Z","updated_at":"2017-07-30T15:04:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"7d3d39ec-422f-42c8-b1ed-999d2490a5ae","html_url":"https://github.com/SleekPanther/graph-strong-connectivity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SleekPanther/graph-strong-connectivity","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SleekPanther%2Fgraph-strong-connectivity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SleekPanther%2Fgraph-strong-connectivity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SleekPanther%2Fgraph-strong-connectivity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SleekPanther%2Fgraph-strong-connectivity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SleekPanther","download_url":"https://codeload.github.com/SleekPanther/graph-strong-connectivity/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SleekPanther%2Fgraph-strong-connectivity/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32093157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["algorithm-design","bfs","breadth-first-search","directed","directed-edge","directed-graph","edge","graph-algorithms","graphs","noah","noah-patullo","noahpatullo","pattullo","pattulo","patullo","patulo","strong-connectivity","strongly","strongly-connected","strongly-connected-components"],"created_at":"2024-11-15T05:42:54.433Z","updated_at":"2026-04-21T13:04:53.390Z","avatar_url":"https://github.com/SleekPanther.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Strong Connectivity\nApplication of Breadth-First Search to see if a directed graph is Strongly Connected\n\n## Problem Statement\n- Vertex `u` and `v` are **mutually reachable** if there is a path from `u` to `v` and also a path from `v` to `u`\n- A directed graph is **strongly connected** if every pair of nodes is mutually reachable\n\n## Algorithm\n- Run BFS from any vertex\n- Make G\u003csup\u003erev\u003c/sup\u003e, a new graph with edge directions reversed\n- Run BFS on G\u003csup\u003erev\u003c/sup\u003e\n- Return true iff every vertex is reachable in both BFS on G and BFS on G\u003csup\u003erev\u003c/sup\u003e\n\n## Input Graphs\n### Graph 1 (is stronly connected)\n\u003cimg src=\"images/graph1.png\" width=\"400\"\u003e\n\n### Graph 1 Reversed\n\u003cimg src=\"images/graph1-reversed.png\" width=\"400\"\u003e\n\n\u003cbr\u003e \n\n### Graph 2 (NOT stronly connected)\n\u003cimg src=\"images/graph2.png\" width=\"400\"\u003e\n\n### Graph 2 Reversed\n\u003cimg src=\"images/graph2-reversed.png\" width=\"400\"\u003e\n\n## Usage\n- Make a `new StrongConnectivity()` object\n- Create a graph as an `ArrayList\u003cArrayList\u003cInteger\u003e\u003e` **Adjacency List**  \n  - Each `graph.get(u)` is an `ArrayList\u003cInteger\u003e` of vertices representing edges going **From `u`**\n  - Vertex names are simply increasing integer values, no need for human-readable vertex ID's like `S` or `T`\n  - Graph adjacency list must have all edges represented\n  - If there are no outgoing edges from a vertex, add an empty `ArrayList`  \n  `graph2.add(new ArrayList\u003cInteger\u003e());`\n- Call `isStronglyConnected()` and pass in a graph  \n`boolean isGraph1StronglyConnected = strongConnectivityFinder.isStronglyConnected(graph1);`\n\n## Code Notes\n- `isStronglyConnected()` always chooses vertex `0` to start BFS, but that's completely arbitrary\n\n## References\n- [Strong Connectivity - Richard Zanibbi](https://www.cs.rit.edu/~rlaz/algorithms20082/slides/DAGs.pdf#page=4)\n- [Strong Connectivity - Kevin Wayne](https://www.cs.princeton.edu/~wayne/kleinberg-tardos/pdf/03Graphs.pdf#page=41)\n- [Strong Connectivity - Jaehyun Park](https://web.stanford.edu/class/cs97si/06-basic-graph-algorithms.pdf#page=36)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleekpanther%2Fgraph-strong-connectivity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsleekpanther%2Fgraph-strong-connectivity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsleekpanther%2Fgraph-strong-connectivity/lists"}