A Java Swing desktop application for visualizing graphs through an interactive adjacency matrix.
- Adjacency matrix editor — enter edge weights directly into a table to build the graph in real time
- Directed / Undirected — switch between graph types; the matrix mirrors symmetrically for undirected graphs
- Weighted / Unweighted — supports arbitrary integer weights or simple 0/1 connectivity
- Smooth rendering — nodes and curved edges are drawn with anti-aliasing and drop shadows
- Pan & Zoom — navigate the canvas by dragging and scrolling the mouse wheel
| File | Description |
|---|---|
Node.java |
Represents a graph node with position and drawing logic |
Edge.java |
Represents an edge (directed or undirected) with optional weight and curved rendering |
Graph.java |
Stores the list of nodes and edges; handles edge insertion rules |
GraphPanel.java |
Swing panel that renders the graph with pan and zoom support |
MainWindow.java |
Main window with toolbar, adjacency matrix table and event handling |
- Compile all
.javafiles inside thegraph_algorithmspackage - Run
MainWindow
javac graph_algorithms/*.java
java graph_algorithms.MainWindowRequires Java 8 or later.
- Type the number of nodes (1–20) in the Nodes field and click Create matrix
- Select Directed or Undirected and Weighted or Unweighted
- Fill in the adjacency matrix — the graph updates automatically
- Use the mouse wheel to zoom and drag to pan the canvas
- Click Reset to start over
Sara Belli