/Efficient-Graph-Algorithms

A C++ implementation of a weighted graph using an adjacency matrix. Features include vertex and edge management, shortest distance calculation with Dijkstra's algorithm , and adjacency matrix visualization. Robust error handling included. Install by including weighted_graph.h and using the provided skeleton files for testing.

Primary LanguageC++

Efficient-Graph-Algorithms

Weighted Graph Class

A C++ implementation of a weighted graph class using an adjacency matrix representation.

Overview

This repository contains a C++ implementation of a weighted graph class. Weighted graphs are graphs in which each edge has an associated numerical value called weight. The class provides functionality for managing vertices and edges, calculating distances between vertices, and printing the graph's adjacency matrix.

Features

  • Vertex and Edge Management: Insert and manage vertices and edges.
  • Distance Calculation: Calculate the shortest distance between two vertices using Dijkstra's algorithm.
  • Graph Representation: Visualize the graph's adjacency matrix.
  • Robust Error Handling: Throw exceptions for invalid operations or out-of-bounds vertex indices.

Installation

  1. Include the weighted_graph.h header file in your C++ project
  2. Use skeleton files to test.

Usage

  1. Initialization: Create a Weighted_graph object.
  2. Vertex and Edge Operations: Insert vertices and edges using the insert method.
  3. Graph Queries: Retrieve information about vertices, edges, and distances using appropriate methods.
  4. Printing: Print the adjacency matrix of the graph using the operator<< overload.

Files Included

  • Weighted_graph.h: Header file for the weighted graph class implementation.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

Contact

For more information or inquiries, contact: