{"id":26035404,"url":"https://github.com/nelsonbn/algorithms-data-structures-graphs-representation","last_synced_at":"2025-07-15T03:36:05.657Z","repository":{"id":280278312,"uuid":"941494750","full_name":"NelsonBN/algorithms-data-structures-graphs-representation","owner":"NelsonBN","description":"Algorithms and Data Structures - Graphs Representation","archived":false,"fork":false,"pushed_at":"2025-03-03T02:18:29.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-04T21:56:18.872Z","etag":null,"topics":["algorithms","algorithms-and-data-structures","data-structures","graphs"],"latest_commit_sha":null,"homepage":"","language":"Python","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/NelsonBN.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":"2025-03-02T12:36:30.000Z","updated_at":"2025-03-22T15:35:27.000Z","dependencies_parsed_at":"2025-03-03T03:24:33.714Z","dependency_job_id":null,"html_url":"https://github.com/NelsonBN/algorithms-data-structures-graphs-representation","commit_stats":null,"previous_names":["nelsonbn/algorithms-data-structures-graphs","nelsonbn/algorithms-data-structures-graphs-representation"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NelsonBN/algorithms-data-structures-graphs-representation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NelsonBN%2Falgorithms-data-structures-graphs-representation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NelsonBN%2Falgorithms-data-structures-graphs-representation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NelsonBN%2Falgorithms-data-structures-graphs-representation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NelsonBN%2Falgorithms-data-structures-graphs-representation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NelsonBN","download_url":"https://codeload.github.com/NelsonBN/algorithms-data-structures-graphs-representation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NelsonBN%2Falgorithms-data-structures-graphs-representation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265397916,"owners_count":23758455,"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","algorithms-and-data-structures","data-structures","graphs"],"created_at":"2025-03-07T04:52:28.311Z","updated_at":"2025-07-15T03:36:05.619Z","avatar_url":"https://github.com/NelsonBN.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Algorithms and Data Structures - Graphs Representation\n\n\n\n## Adjacency Matrix\n\n### Asymptotic Complexity\n- Time complexity:\n  - Insertion: O(1)\n  - Deletion: O(1)\n- Space complexity: O(V^2)\n\n### Pros\n- Simple to implement\n- Fast to access edge (u, v), O(1), fast to add and remove edges\n\n### Cons\n- Space complexity is O(V^2)\n- Its not efficient for sparse graphs\n\n### Demos\n- [Adjacency Matrix](./src/1.1-adjacency-matrix.py)\n- [Undirected Graph](./src/1.2-undirected-graph-matrix.py)\n- [Directed Graph](./src/1.3-directed-graph-matrix.py)\n- [Adjacency Matrix - Playground](./src/1.4-adjacency-matrix-playground.py)\n- [Adjacency Matrix - Weighted](./src/1.5-adjacency-matrix-weighted.py)\n\n\n\n## Adjacency List\n\n### Asymptotic Complexity\n- Time complexity:\n  - Insertion: O(V) using list, O(1) using Hash Table\n  - Deletion: O(V) using list, O(1) using Hash Table\n- Space complexity: O(V + E)\n\n### Pros\n- Space complexity is O(V + E)\n- Efficient for sparse graphs\n\n### Cons\n- Slow to access edge (u, v), O(V) using list, but can be O(1) using Hash Table\n\n### Demos\n- [Adjacency List](./src/2.1-adjacency-list.py)\n- [Adjacency List - With Hash Table](./src/2.2-adjacency-list-with-hashtable.py)\n- [Adjacency List - Playground](./src/2.3-adjacency-list-playground.py)\n\n\n\n## Edge List\n\n### Asymptotic Complexity\n- Time complexity:\n  - Insertion: O(1)\n  - Deletion: O(E)\n- Space complexity: O(E)\n\n### Pros\n- Space complexity is O(E)\n- Fast to add edges\n\n### Cons\n- Slow to access edge (u, v), O(E)\n\n### Demos\n- [Edge List](./src/3.1-edge-list.py)\n\n\n\n## References\n- [Other Algorithms \u0026 Data Structures](https://github.com/NelsonBN/algorithms-data-structures)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelsonbn%2Falgorithms-data-structures-graphs-representation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnelsonbn%2Falgorithms-data-structures-graphs-representation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnelsonbn%2Falgorithms-data-structures-graphs-representation/lists"}