This program takes density and no of vertices in a graph and then displays the graph.
Introduction: This C++ program is designed as a graph analysis and visualization tool, featuring a graphical user interface (GUI) built using the Qt C++ framework. The tool generates a random graph based on user-defined parameters and provides functionalities for analyzing the graph, including degree calculation, identification of nodes with maximum and minimum degrees, display of the raw adjacency matrix, and finding neighbors of a given node.
Features:
-
Graph Generation:
- The program generates a random undirected graph based on user-specified parameters: the number of nodes and density.
-
Degree Analysis:
- Users can inquire about the degree of a specific node, find the node with the maximum degree, and find the node with the minimum degree.
-
Adjacency Matrix Display:
- The raw adjacency matrix of the generated graph can be displayed, providing a comprehensive view of the graph structure.
-
Neighborhood Identification:
- Users can find the neighbors of a specified node, gaining insights into the connectivity of the graph.
-
Graphical User Interface (GUI):
- The program incorporates a user-friendly GUI built with the Qt framework, enhancing the overall user experience.
Usage:
-
Graph Generation:
- Enter the number of nodes and desired density when prompted.
- The program will generate a random graph based on the provided parameters.
-
Degree Analysis:
- Choose from options (a to e) to perform various degree-related analyses:
- a) Show Degree of a Node
- b) Find Node with Maximum Degree
- c) Find Node with Minimum Degree
- d) Display the Raw Adjacency Matrix
- e) Find Neighbors of a Given Node
- Choose from options (a to e) to perform various degree-related analyses:
-
Graphical User Interface:
- The GUI enhances the visual representation and user interaction with the graph analysis tool.
Execution:
-
GUI Mode:
- Ensure that the Qt framework is properly installed.
- Compile and run the program to access the GUI.
- Use the GUI controls to interact with the graph and perform analyses.
-
Console Mode:
- For console-based interaction, follow the prompts to enter the number of nodes and density.
- Use the console menu (a to e) for various analyses.
Note:
- This program utilizes the
conio.h
library for getch() to capture user inputs in the console.
Example:
- An example run of the program is provided to illustrate its functionalities and outputs.
Dependencies:
- Qt framework for GUI (ensure proper installation).