|
| 1 | +# Graph Generation for NG911 Simulations |
| 2 | + |
| 3 | +## Overview |
| 4 | +This repository provides scripts for generating and visualizing synthetic star graphs representing Public Safety Answering Points (PSAPs), responders, and callers. These graphs are designed for simulations and analysis within emergency response systems. The generated graphs can be visualized using `matplotlib` and saved in GraphML format for further use. |
| 5 | + |
| 6 | +## Purpose |
| 7 | +The main objective is to create synthetic star graphs representing emergency response systems with: |
| 8 | +- PSAPs at the center. |
| 9 | +- Responders and callers distributed within specified regions. |
| 10 | +- Special handling for prime numbers of PSAPs and other specific cases. |
| 11 | +- The `visualize_generation.py` script specifically focuses on visualizing the generation of a synthetic network graph from parameterized GraphML data, highlighting different node types and their positions within defined regions. |
| 12 | + |
| 13 | +## graph_generation folder |
| 14 | + |
| 15 | +### `graph_generation.py` |
| 16 | +Generates synthetic star graphs based on input parameters. The script handles various scenarios, including special cases such as prime numbers of PSAPs, to ensure appropriate distribution of graph elements. It includes logic for: |
| 17 | + - Distributing PSAPs, responders, and callers within defined regions. |
| 18 | + - Handling prime numbers of PSAPs by creating an extra region and combining it appropriately. |
| 19 | + - Ensuring each region contains a star-shaped graph centered on a PSAP. |
| 20 | + |
| 21 | +### `visualize_generation.py` |
| 22 | +Visualizes the graphs generated by `graph_generation.py` from the GraphML file. It displays the graph with color-coded nodes for PSAPs, callers, and responders. It outlines the rectangular boundary, PSAP regions, and caller regions, allowing for easy analysis and verification of the graph structure. |
| 23 | + |
| 24 | +### `format_graphml.py` |
| 25 | +Converts the original synthetic GraphML file to a format that can be used within the cluster-point call generation and Graphitti simulations. This script ensures the GraphML file is compatible with the tools and configurations used in subsequent simulation steps. |
| 26 | + |
| 27 | +## call_generation folder |
| 28 | +Contains scripts for generating call data from the GraphML files created in the `graphml_generation` folder. These scripts use the structured graphs to simulate call events, providing data for emergency response simulations. |
| 29 | + |
| 30 | +## config_files folder |
| 31 | +Holds configuration files for GraphGeneration Graphitti simulations. These files use the generated graphs and call data to configure and run various simulation scenarios, testing different aspects of emergency response systems. |
| 32 | + |
| 33 | +## graphml_generation folder |
| 34 | +Stores the generated graph models from `graph_generation.py`, formatted through `format_graphml.py`. These GraphML files serve as the basis for further simulations and call generation, ensuring consistency and compatibility across different simulation tools. |
| 35 | + |
| 36 | +## output_files folder |
| 37 | +Contains the output files from the simulations run using the configuration files in the `config_files` folder. These outputs include results and logs from the simulation runs, which can be analyzed to evaluate the performance and effectiveness of the generated graphs and configurations. |
| 38 | + |
| 39 | +## test_visualization folder |
| 40 | +Holds visualization PNGs of various cases from the `graph_generation.py` script, visualized using `visualize_generation.py`. These visualizations provide a graphical representation of the generated graphs, highlighting the structure and distribution of PSAPs, callers, and responders. |
| 41 | + |
| 42 | +## Install Dependencies |
| 43 | +Ensure you have all required libraries installed. Use `pip` or `conda` for installation. |
| 44 | + |
| 45 | +## Libraries Used |
| 46 | +- `matplotlib.pyplot`: For creating and displaying visualizations of the graph. |
| 47 | +- `networkx`: For creating, manipulating, and saving network graphs. |
| 48 | +- `random`: For generating random positions for responders and callers within specified regions. |
| 49 | +- `xml.etree.ElementTree`: For creating and manipulating XML elements. |
| 50 | +- `xml.dom.minidom`: For printing XML information. |
| 51 | +- `math`: Provides mathematical functions used for calculating regions and dimensions. |
| 52 | + |
| 53 | +## Mathematical Logic |
| 54 | +- **Region Partitioning:** Calculates the number of rows and columns needed to partition a bounding box into a specified number of regions. Uses the square root to determine the optimal grid layout and adjusts as necessary to match the required number of regions. |
| 55 | +- **Region Dimensions:** Computes the width and height of each region based on the bounding box dimensions and the number of rows and columns. |
| 56 | +- **Region Merging:** Combines two rectangular regions into a single larger region by determining the minimum and maximum coordinates. |
| 57 | +- **Prime Number Handling:** Checks if the number of PSAPs is a prime number, which affects how regions are created and combined. |
| 58 | +- **Random Positioning:** Generates random positions for responders and callers within their designated regions. |
| 59 | + |
| 60 | +## Contributors |
| 61 | +- Jasleen Kaur Saini |
| 62 | +- Zaina Shaikh |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | + |
0 commit comments