Skip to content

MarkDGraham/ComputerNetworking-MTTPNetworkSim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multipacket Transfer Protocol (MTTP) Simulation

This project simulates packet transfer over a network using a custom Multipacket Transfer Protocol (MTTP) model.
It combines Python for network generation, visualization, and k-shortest path calculations, with C++ for path analysis, TCP/UDP timing calculations, and probability of failure analysis.


🛠 Technical Highlights

  • Languages / Tools: C++, Python 3.x, NetworkX, Matplotlib
  • Key Concepts:
    • Graph-based network modeling
    • K-shortest path calculation
    • Packet transfer timing (UDP & TCP)
    • Path failure probability analysis
  • Skills Demonstrated:
    • Systems-level programming in C++
    • Python scripting for graph generation and visualization
    • Integration of Python and C++ workflows
    • Data parsing, file I/O, and algorithmic computation

🚀 Project Workflow

  1. Python Network Generation (driver.py)

    • Generates a random network graph with a specified number of nodes using NetworkX.
    • Assigns random weights to edges (simulating transfer times in ms).
    • Computes k-shortest paths from a start node to an end node.
    • Saves the network edges and path data to output.txt.
  2. C++ Path Analysis (driver.cpp)

    • Reads output.txt for network edges and k-shortest paths.
    • For each path:
      • Calculates UDP transmission time as the sum of edge weights.
      • Calculates TCP transmission time as UDP + 3 ms per node.
      • Tracks probability of failure for each path.
    • Computes combined failure probabilities for all path combinations.
    • Outputs results to pathAnalysis.txt.
  3. Output Visualization

    • Python generates a network plot showing nodes and edge weights (requires matplotlib).
    • C++ outputs a text-based analysis including:
      • Path sequences
      • UDP/TCP times
      • Failure probabilities
      • Combined failure probabilities for path sets

📝 Steps to Run the Simulation

Follow these steps to generate a network, compute paths, and analyze them:

  1. Clone the repository and navigate to the project folder.

  2. Run the Python script driver.py to generate a random network:

    • This will create a network graph with labeled nodes and random edge weights.
    • The script will compute k-shortest paths from the start node to the end node.
    • Results are saved automatically to output.txt.
  3. Compile the C++ program driver.cpp:

    • This will create an executable (e.g., pathAnalysis) that reads output.txt.
  4. Run the C++ executable:

    • The program calculates UDP and TCP times for each path.
    • It also computes failure probabilities for each path and all path combinations.
    • Results are saved to pathAnalysis.txt.
  5. View the results in pathAnalysis.txt:

    • Each path with nodes is listed along with UDP/TCP times.
    • Individual and combined path failure probabilities are included.
  6. Optional edits:

    • Modify driver.py to change the number of nodes, probability of edges, or random seed.
    • Modify driver.cpp to adjust TCP/UDP calculation parameters or failure probability logic.

💡 Key Takeaways

  • Demonstrates integration of Python and C++ workflows for simulation and analysis.
  • Simulates network behavior, packet transfer times, and path reliability.
  • Implements algorithmic combination logic to calculate multi-path failure probabilities.
  • Useful for learning graph algorithms, network modeling, and system simulations.

🔧 Extending the Simulation

  • Change the number of nodes or probability of edges in Python (generate_network) to simulate different networks.
  • Adjust edge weight ranges to model different latency distributions.
  • Extend driver.cpp to simulate additional protocols or more complex failure models.
  • Enhance Python visualization with color-coded edges for high-latency links or failing paths.

📂 Project Structure

MTTPNetworkSim/

├─ driver.cpp # C++ simulation and path analysis
├─ driver.py # Python network generation and visualization
├─ output.txt # Network edges and k-shortest paths (generated by Python)
├─ pathAnalysis.txt # Analysis output (generated by C++)
├─ README.md


🤳 Connect with Me

MarkDGraham | LinkedIn

About

An analysis of multipacket transfer protocol (MTTP) in which an understanding of packet failure can occur.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors