Results Display Panel
Relevant source files
The following files were used as context for generating this wiki page:The Results Display Panel is the primary graphical user interface for the C# "Network Analyzer" application. Its purpose is to load a network structure from an edge list file, compute a variety of network science metrics, and present the results to the user through statistical labels and graphical charts. This tool is a core component of the project, designed to analyze network properties like clustering, degree correlation, and degree distribution, as described in the project's README.md.
The panel is implemented as a Windows Form (Form1) and serves as the main entry point and interactive surface for the C# analysis program. It provides functionality to open files, process network data, and visualize key characteristics, particularly those related to scale-free networks.
Sources: Form1.cs, Form1.Designer.cs, README.md:3-5
UI Components and Layout
The main window, titled "Network Analyzer", is composed of several key areas: a menu bar for file operations, a panel for displaying summary statistics, a status text box, and two primary charts for data visualization.
Sources: Form1.Designer.cs:290, Form1.Designer.cs:291
The following diagram shows the logical arrangement of the main UI components on the Form1 window.
This diagram illustrates the layout of UI elements within the main application window.
Sources: Form1.Designer.cs
Key UI Elements
The table below details the primary UI controls defined in Form1.Designer.cs and their functions.
| Component ID | Type | Description |
|---|---|---|
menuStrip1 | MenuStrip | Contains the "File" -> "Open" menu to load an edge list file. |
lblDataset | Label | Displays the name of the loaded dataset file. |
lblNodes | Label | Displays the total number of nodes in the network. |
lblLinks | Label | Displays the total number of links (edges) in the network. |
lblMean | Label | Shows the average degree of the network. |
lblSelf | Label | Shows the count of self-linking nodes. |
lblDupe | Label | Shows the count of duplicate links. |
lblCluster | Label | Displays the average clustering coefficient (if chkClustering is checked). |
lblCorrelation | Label | Displays the calculated degree correlation exponent. |
lblGamma | Label | Displays the calculated degree exponent (gamma) for the degree distribution. |
lblMin / lblMax | Label | Display the minimum and maximum node degrees found in the network. |
chkClustering | CheckBox | A checkbox to enable/disable the calculation of the average clustering coefficient. |
txtCutoff | TextBox | An input field to set a minimum degree cutoff for the cumulative degree distribution regression. |
textBox1 | TextBox | A multi-line text box used to display real-time status updates during data processing. |
chart1 | Chart | Visualizes the Degree Correlation, plotting average neighbor degree vs. node degree. |
chart2 | Chart | Visualizes the Cumulative Degree Distribution. |
Sources: Form1.Designer.cs:46-285
Data Processing and Display Flow
The analysis process is initiated when the user selects a file via the "Open" menu item. This triggers the openToolStripMenuItem_Click event handler, which orchestrates the entire workflow from file reading to UI updates.
The following flowchart outlines the sequence of operations:
This flowchart shows the data processing pipeline from file selection to displaying results on the panel.
Sources: Form1.cs:202-355
Core Data Structures
The application's logic is built around a few key data structures defined within Form1.cs to represent the network.
Sources: Form1.cs:54-199
This class diagram illustrates the relationships between the main data structures used for network representation and analysis.
Sources: Form1.cs:54-199
Edge: A simple class to represent a link between two nodes,aandb.
Sources: Form1.cs:56-67Node: Represents a single node in the network. It stores itsnode_ID,degree, a list of itsneighbors, itsclusteringcoefficient, and the average degree of its neighbors (neighbors_degree).
Sources: Form1.cs:69-82NodeList: A container for allNodeobjects. It is constructed from an initialList<Edge>. During its construction, it calculates basic properties likeselfies,dupes,max_degree, andmin_degree, and populates the degree and neighbor information for each node. It also contains the method for calculating the global average clustering coefficient.
Sources: Form1.cs:84-173
Chart Generation
The panel features two charts that are central to the network analysis. Both charts use logarithmic scaling on both axes to better visualize power-law relationships, which are characteristic of scale-free networks.
Sources: Form1.cs:289-290, 347-348
Degree Correlation Chart (chart1)
This chart visualizes the degree correlation of the network.
- Purpose: To determine if the network is assortative (high-degree nodes connect to other high-degree nodes) or disassortative (high-degree nodes connect to low-degree nodes).
- X-axis: Node Degree (k)
- Y-axis: Average Neighbor Degree (k_nn(k))
- Implementation:
- For each degree value
degpresent in the network, the code calculates the average ofneighbors_degreefor all nodes with that degree. - These
(deg, avg_neighbors_degree)pairs are plotted as points. - A power-law regression line (
y = c * x^exp) is fitted to these points usingMathNet.Numerics.Fit.Power. - The points and the red regression line are plotted on
chart1. The calculated exponent is displayed inlblCorrelation.
- For each degree value
Sources: Form1.cs:259-293, Form1.Designer.cs:79-82
Cumulative Degree Distribution Chart (chart2)
This chart visualizes the cumulative probability distribution of node degrees, P(k).
- Purpose: To analyze if the network follows a power-law (scale-free) degree distribution.
- X-axis: Node Degree (k)
- Y-axis: Cumulative Probability P(k) (the fraction of nodes with degree
kor greater). - Implementation:
- The code iterates from degree 1 to
max_degree, calculating the fraction of nodes with a degree less than the current one and subtracting it from a running totalprev(initialized to 1). This gives the cumulative probability. - These
(deg, P(k))pairs are plotted as points. - A "shadow" series is created containing only points where the degree is greater than the value in
txtCutoff. - A power-law regression is performed on this shadow series to find the exponent.
- The degree exponent
gammais calculated as1 - exp(whereexpis the exponent from the cumulative distribution fit) and displayed inlblGamma. - The points and the red regression line are plotted on
chart2.
- The code iterates from degree 1 to
Sources: Form1.cs:316-353, Form1.Designer.cs:238-241
Related Project Components
While the Results Display Panel is part of the C# application, other files in the repository serve related purposes in the overall study of network science.
Barabasi.cs: A console application that can generate a synthetic network using the Barabasi-Albert preferential attachment model. The output is an edge list file (.txt) that can be directly loaded and analyzed by the "Network Analyzer" GUI.
Sources: Barabasi.cs:11-15Network.py: A Python script that performs a similar function to the C# application. It reads an edge list, calculates the degree distribution, performs a linear regression on the log-log data to find the exponent (gamma), and plots the results using thebokehlibrary. This represents an alternative implementation of the core analysis.
Sources: Network.py