{"id":26432689,"url":"https://github.com/ratna-babu/generating-graphs","last_synced_at":"2025-10-10T10:32:45.146Z","repository":{"id":274308430,"uuid":"922525282","full_name":"Ratna-Babu/Generating-Graphs","owner":"Ratna-Babu","description":"Generate, color, and visualize random graphs using Python's NetworkX and Matplotlib. Includes compression and storage of graph data with .gz and pickle. Ideal for exploring graph coloring and greedy algorithms in graph theory.","archived":false,"fork":false,"pushed_at":"2025-04-22T09:31:37.000Z","size":94,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-22T10:55:19.503Z","etag":null,"topics":["data-visualization","erdos-renyi","graph-coloring","graph-theory","greedy-algorithm","matplotlib","networkx","python","random-graph","random-graph-generation"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Ratna-Babu.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":"2025-01-26T13:02:34.000Z","updated_at":"2025-04-22T09:34:43.000Z","dependencies_parsed_at":"2025-01-26T14:29:17.072Z","dependency_job_id":null,"html_url":"https://github.com/Ratna-Babu/Generating-Graphs","commit_stats":null,"previous_names":["ratna-babu/generating-graphs-","ratna-babu/generating-graphs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ratna-Babu/Generating-Graphs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ratna-Babu%2FGenerating-Graphs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ratna-Babu%2FGenerating-Graphs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ratna-Babu%2FGenerating-Graphs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ratna-Babu%2FGenerating-Graphs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ratna-Babu","download_url":"https://codeload.github.com/Ratna-Babu/Generating-Graphs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ratna-Babu%2FGenerating-Graphs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003549,"owners_count":26083595,"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-10-10T02:00:06.843Z","response_time":62,"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":["data-visualization","erdos-renyi","graph-coloring","graph-theory","greedy-algorithm","matplotlib","networkx","python","random-graph","random-graph-generation"],"created_at":"2025-03-18T06:19:41.593Z","updated_at":"2025-10-10T10:32:45.141Z","avatar_url":"https://github.com/Ratna-Babu.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🎨 Graph Coloring Visualization and Compression\n\nThis project demonstrates the generation of random graphs, the application of graph coloring algorithms, visualization of the results, and saving the graph data in a compressed `.gz` format using Python. It uses the `networkx` library for graph operations and `matplotlib` for visualization.\n\n---\n\n## 📌 Features\n\n- ✅ Generate random undirected graphs using the Erdős–Rényi model\n- 🎨 Color graphs using a greedy algorithm (`largest_first` strategy)\n- 🖼️ Visualize colored graphs using Matplotlib\n- 📀 Save the graph and its coloring in a compressed `.gz` format\n\n---\n\n## 🛠️ Technologies Used\n\n- [NetworkX](https://networkx.org/) - Graph generation and algorithms\n- [Matplotlib](https://matplotlib.org/) - Visualization\n- [NumPy](https://numpy.org/) - Math utility\n- [Gzip](https://docs.python.org/3/library/gzip.html) - Compression\n- [Pickle](https://docs.python.org/3/library/pickle.html) - Object serialization\n\n---\n\n## 🚀 Getting Started\n\n### 🔧 Installation\n\nMake sure you have Python 3.x installed. Then install the required libraries:\n\n```bash\npip install networkx matplotlib numpy\n```\n\n### ▶️ Running the Code\n\nThis project is implemented in a Jupyter Notebook named `Generating_Random_Graph.ipynb`. Open the notebook and run the cells sequentially to:\n\n1. Generate a random graph with `num_nodes` and `num_edges`\n2. Apply a greedy coloring algorithm\n3. Display the graph with nodes colored by their assigned color\n4. Save the graph and its coloring to `graph_coloring_data.gz`\n\n---\n\n## 📁 File Overview\n\n| File                          | Description                                                  |\n|-------------------------------|--------------------------------------------------------------|\n| `Generating_Random_Graph.ipynb` | Jupyter Notebook to generate, color, visualize, and save a graph |\n| `graph_coloring_data.gz`      | Compressed file containing the graph object and coloring dict|\n| `README.md`                   | You’re reading it!                                           |\n\n---\n\n## 🧠 Understanding Graph Coloring\n\nGraph coloring is the assignment of labels (colors) to vertices of a graph so that no two adjacent vertices share the same color. It's used in:\n\n- Scheduling problems\n- Map coloring\n- Register allocation in compilers\n- Frequency assignment\n\nThis project uses the **greedy coloring algorithm** with the `largest_first` strategy, which colors the nodes in descending order of their degrees.\n\n---\n\n## 📊 Example Output\n\n![Graph Coloring Example](https://github.com/user-attachments/assets/35f3045d-4937-4708-b9cb-619a276bb88f)\n\n\n---\n\n## 📆 Output\n\nAfter execution, a file named `graph_coloring_data.gz` will be created, containing:\n\n```python\n{\n  'graph': \u003cnetworkx.classes.graph.Graph\u003e,\n  'coloring': {0: 0, 1: 1, 2: 0, ...}\n}\n```\n\nTo load this file later:\n\n```python\nimport gzip, pickle\n\nwith gzip.open('graph_coloring_data.gz', 'rb') as f:\n    data = pickle.load(f)\n\nG = data['graph']\ncoloring = data['coloring']\n```\n\n---\n\n## 🤝 Contributing\n\nContributions, issues, and feature requests are welcome!\n\n1. Fork the repository\n2. Create your branch: `git checkout -b feature/your-feature`\n3. Commit your changes: `git commit -m 'Add your message'`\n4. Push to the branch: `git push origin feature/your-feature`\n5. Open a pull request\n\n---\n\n## 📄 License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\n## ⭐️ Show Your Support\n\nIf you found this project useful, please ⭐️ the repository to help others discover it!\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratna-babu%2Fgenerating-graphs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fratna-babu%2Fgenerating-graphs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fratna-babu%2Fgenerating-graphs/lists"}