This project implements a directed graph data structure in C++ with capabilities for loading graph data from files, storing both incoming and outgoing edges, and analyzing graph metrics. It's designed to work with large graph datasets efficiently.
-
Graph.h / Graph.cpp - Core graph data structure implementation
- Uses unordered maps to store adjacency lists for both outgoing (
adj_out) and incoming (adj_in) edges - Implements key methods:
add_edge_unweighted()- Adds edges to the graphcreate_graph()- Loads graph from fileprint_graph()- Displays graph structure
- Uses unordered maps to store adjacency lists for both outgoing (
-
metrics.h / metrics.cpp - Performance and resource monitoring
calculate_total_time()- Measures elapsed time for graph creationcalculate_peak_RAM()- Tracks peak memory usageadd_result_to_file()- Logs results to file
-
main.cpp - Entry point for graph creation and testing
-
CMakeLists.txt - CMake build configuration (C++14 standard)
- bn-65-1K.txt - Sample graph dataset (1140 edges)
- Format: Each line contains two space-separated integers representing an edge from node A to node B
- Orion/ - Alternative implementation with additional graph functionality
- untitled6/ - Experimental or alternative version
- Orionsiteweb/ - Web interface components (HTML/CSS/JS)
- build/ - Ninja build system output
- cmake-build-debug/ - CMake debug build artifacts
- C++14 compatible compiler
- CMake 3.17.3 or higher
mkdir -p build
cd build
cmake ..
cmake --build ../files_list- Efficient Graph Storage - Uses hash maps for O(1) average edge lookup
- Bidirectional Edge Tracking - Maintains both outgoing and incoming edge lists
- Performance Monitoring - Built-in timing and memory usage metrics
- File-based Input - Loads graph definitions from text files
Graph graph;
graph.create_graph("path/to/graph_file.txt");
graph.print_graph();Input graph files should be formatted as:
node_a node_b
node_c node_d
...
Each line represents a directed edge from the first node to the second node.
- The current hardcoded file path in main.cpp should be updated to accept command-line arguments
- metrics.cpp has platform-specific code (Linux /proc/self/status) that may need adjustment for other OSes
- The project includes multiple experimental versions in separate directories for testing different approaches