Graph Theory Calculator

Create interactive graphs, visualize connections, and analyze network structures. Run algorithms to find shortest paths, spanning trees, and explore graph properties.

Graph Controls

Configure your graph and run algorithms

Graph Visualization

Click to add nodes, drag to create edges

Click anywhere to add a node

Drag between nodes to create edges

👆Click canvas to add nodes
Drag between nodes for edges
🖱Right-click to delete

Graph Properties

🔵
Nodes
0
🔗
Edges
0
📈
Density
0.000
🔌
Connected
No
📊
Degree Sequence
[]
📏
Diameter
-

Adjacency Matrix

Create a graph to see its adjacency matrix

Algorithm Results

Select and run an algorithm to see results

Graph Theory Fundamentals

Graph theory studies networks of connected objects. A graph consists of vertices, also called nodes, and edges, which are connections between nodes. This mathematical structure models relationships in computer networks, social networks, transportation systems, and biological networks.

Types of Graphs

Undirected Graph: Edges have no direction. Connections are bidirectional.
Directed Graph: Edges have direction. Connections flow in one direction.
Weighted Graph: Edges have associated weights or costs representing distance, time, or other metrics.
Simple Graph: No loops or multiple edges between the same pair of vertices.
Complete Graph: Every pair of vertices is connected by an edge.
Bipartite Graph: Vertices can be divided into two disjoint sets with edges only between sets.

Graph Algorithms

Shortest Path Algorithms

  • Dijkstra's Algorithm: Finds shortest paths from a source vertex to all other vertices in weighted graphs with non-negative weights.
  • Bellman-Ford Algorithm: Handles negative edge weights and detects negative cycles in graphs.
  • Floyd-Warshall Algorithm: Finds shortest paths between all pairs of vertices using dynamic programming.

Graph Traversal

  • Breadth-First Search (BFS): Explores neighbors level by level, useful for finding shortest unweighted paths.
  • Depth-First Search (DFS): Explores as far as possible along each branch before backtracking.

Minimum Spanning Tree

  • Kruskal's Algorithm: Builds MST by adding edges in order of increasing weight using union-find data structure.
  • Prim's Algorithm: Builds MST by growing the tree from a starting vertex using a priority queue.

Applications

Computer Networks: Routing protocols, network topology analysis, bandwidth optimization.
Social Networks: Friendship graphs, influence analysis, community detection.
Transportation: Road networks, flight routes, logistics optimization.
Biology: Protein interaction networks, phylogenetic trees, metabolic pathways.
Web Graphs: Page ranking algorithms, link analysis, search engine optimization.
Scheduling: Task dependencies, resource allocation, project management.