ArminGh02 / graph-fair-vertex-finder

A CLI app to calculate the fair vertex (vertices) in a graph given a set of source vertices.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graph Fair Vertex Finder

About

This was my final project for Data Structures and Algorithms course at Amirkabir University. It calculates the fair vertex (vertices) in a non-negative weighted undirected graph given some source vertices.

Definition of Fair Vertex

A fair vertex in a graph with a set of source vertices is a vertex with minimum fair score.

Consider the set of source vertices as: {A, B, C, ...}

The fair score for vertex V is calculated using below formula:

FairScore(V) = |Distance(A, V) - Distance(B, V)| + |Distance(A, V) - Distance(C, V)| + |Distance(B, V) - Distance(C, V)| + ...

Example

Input graph should be of this form:

<number of vertices> <number of edges>
<space-separated list of vertices numbers>
<first vertex of edge> <second vertex of edge> <weight of edge>
...

Example

Requirement

It only requires fmt.

To Do

I implemented a minimal STL-like hash map data structure that I wish to extend. If you are a C++ fan, feel free to contribute.

About

A CLI app to calculate the fair vertex (vertices) in a graph given a set of source vertices.


Languages

Language:C++ 100.0%