Weirdcraft
Graph Theory & Algorithms2025Algorithms & Computational Structures

Multi-Language Graph Algorithms Suite (C++, Java, Python)

Comprehensive tri-lingual implementation of fundamental graph structures, benchmarking traversal, topological sorting, and shortest paths in C++, Java, and Python.

Unique Project Permalink & Local Reference
Local Workspace Origin PathD:\Assignment\Graph Lab Project (c++, java, python)

Project Overview & Architecture

An in-depth comparative software project that implements equivalent graph data structures and algorithmic operations across three distinct programming paradigms: low-level compiled C++17, object-oriented Java 11, and dynamic Python 3. The suite parses unweighted graphs, weighted networks, and Directed Acyclic Graphs (DAGs) from benchmark files to test traversal performance.

Key Implementation Highlights

  • ✓Engineered equivalent graph classes across C++ (Graph.cpp), Java (Graph.java), and Python (graph.py).
  • ✓Automated file ingestion testing sample1_unweighted.txt, sample2_weighted.txt, and sample3_dag.txt.
  • ✓Algorithms implemented: Depth-First Search (DFS), Breadth-First Search (BFS), and DAG topological ordering.
  • ✓Comparative runtime profiling and memory allocation analysis across language paradigms.

Implementation Source Code

3 Files
Multi-Language Graph Algorithms Suite (C++, Java, Python) Source Codecpp
File origin: D:\Assignment\Graph Lab Project - c++\Graph.cpp
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#include "Graph.h"
#include <iostream>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

Graph::Graph() {}

Graph::~Graph() {
    for (auto& pair : vertices) {
        delete pair.second;
    }
}

void Graph::addVertex(const string& name) {
    if (vertices.find(name) == vertices.end()) {
        vertices[name] = new Vertex(name);
    }
}

void Graph::addEdge(const string& from, const string& to, int weight) {
    if (vertices.find(from) == vertices.end()) addVertex(from);
    if (vertices.find(to) == vertices.end()) addVertex(to);
    vertices[from]->adjacencyList.push_back(Edge(to, weight));
}

vector<string> Graph::bfs(const string& start, const string& end) {
    if (vertices.find(start) == vertices.end() || vertices.find(end) == vertices.end())
        return {};

    unordered_set<string> visited;
    queue<vector<string>> q;
    q.push({start});
    visited.insert(start);

    while (!q.empty()) {
        vector<string> path = q.front();
        q.pop();
        string current = path.back();

        if (current == end) return path;

        for (const Edge& edge : vertices[current]->adjacencyList) {
            if (visited.find(edge.destination) == visited.end()) {
                visited.insert(edge.destination);
                vector<string> newPath = path;
                newPath.push_back(edge.destination);
                q.push(newPath);
            }
        }
    }
    return {};
}
54 linesVerified from local workspace

Technologies & Tools

C++17 (STL)Java 11Python 3Graph TheoryAdjacency ListsTopological SortDijkstra Shortest Path

Academic Classification

Program / FocusAlgorithms & Computational Structures
Project Timeline2025

More in Data Structures, Algorithms & Small Lab Projects

View all in category
Weirdcraft

The municipal department of curiosities: hand-built games, physics toys, and a gallery that re-hangs itself every midnight.

© 2026 WEIRDCRAFT · Municipal Dept. of Curiosities

Free admission · No trackers · Open all night