ronaldnwilliams / graph-diameter-app

This is a graph diameter app that I made for a code challenge. It calculates the diameter of an undirected graph.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Graph Diameter App

alt text

Java app that I made for a code challenge. It calculates the diameter of an undirected graph.

It takes a txt file in the following format:
A – B
B – C
B – D
D – E
where “A”, “B”, “C”, “D” and “E” are names of the nodes and “-” depicts a path between the nodes. Node name can be any sequence of upper case letters and numbers without spaces e.g. “A2B3”.

It then returns the diameter of the graph or if the graph is disconnected Integer.MAX_VALUE


Prerequisites

You will need the following installed:


Installation

git clone https://github.com/ronaldnwilliams/graph-diameter-app.git
cd graph-diameter-app.git


Run

gradle run
or to run this app with your own txt file that follows the above formatting:
gradle run --args '[some file path]'


Test

gradle test
open build/reports/tests/test/index.html


References

Introduction to Programming in Java: An Interdisciplinary Aproach (2nd Edition)
by Robert Sedgewick and Kevin Wayne
Chapter 4-Algorithms and Data Structures (4.5-Case Study: Small-World Phenomenon)

About

This is a graph diameter app that I made for a code challenge. It calculates the diameter of an undirected graph.


Languages

Language:Java 39.9%Language:HTML 26.3%Language:JavaScript 19.7%Language:CSS 14.2%