Skip to content

MikaYeghi/cpm-network-diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CPM Network Diagram Generator

This project is a Critical Path Method (CPM) network diagram generator for project management.
It reads activity data from a CSV file, computes scheduling metrics (ES, EF, LS, LF, TF), and produces a clean network diagram with critical paths highlighted.

The diagrams are rendered with Graphviz in a grid-like layout with orthogonal connectors.


Features

  • Computes:
    • Earliest Start (ES)
    • Earliest Finish (EF)
    • Latest Start (LS)
    • Latest Finish (LF)
    • Total Float (TF)
  • Highlights the critical path (zero float) in red
  • Outputs diagrams as PNG, SVG, or PDF
  • Grid-based layout with square connectors for clarity
  • Simple CSV input format

Installation

We recommend using conda to manage the environment.

# Create a new environment
conda create -n cpm-diagram python=3.10 -y
conda activate cpm-diagram

# Install dependencies
pip install pandas graphviz

Make sure you have the Graphviz binaries installed. On Ubuntu/Debian:

sudo apt-get install graphviz

On macOS (with Homebrew):

brew install graphviz

Usage

1. Prepare your CSV file

Example project.csv:

id,description,duration,predecessors
A,Kickoff,1,
B,Design,5,A
C,Procurement,4,A
D,Implementation,7,B,C
E,Testing,3,D
  • id: Unique activity ID (letters/numbers)
  • description: Short task description
  • duration: Task duration in days
  • predecessors: Comma-separated list of task IDs (leave blank if none)

2. Run the program

python cpm_network_diagram.py project.csv output.png

This generates output.png with the full CPM network diagram.

You can also output to SVG or PDF by changing the file extension:

python cpm_network_diagram.py project.csv output.svg
python cpm_network_diagram.py project.csv output.pdf

Example Output

For the demo CSV above, the generated diagram looks like this:

CPM Network Diagram


License

MIT License – feel free to use and adapt this tool in your own projects.

About

A Python tool that computes and visualizes CPM project schedules with Graphviz. Clean diagrams with critical paths highlighted.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages