Fierozen / DirectedGraphDemo

This is an application that demonstrates searching for the shortest path in a directed graph.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DirectedGraphDemo

This is an application that demonstrates searching for a path between two nodes in a directed graph. If at least one path is found, it is printed.

This development problem will deal with finding a path from one node to another in a non-weighted, directional graph. There are no restrictions on usage of standard Java packages.

Create a Java application that takes a single file name, and two node ID strings as parameters (<filename> <node1> <node2>). The file will consist graph edge data, one edge per line. If a line that contains "AA DD" describes an edge that connects node AA to node DD, in that direction only. Create the necessary data structures to store an arbitrarily sized graph, then determine whether it is possible reach reach node1 from node2. If it is possible to complete that traversal, then print out the path as a series of node IDs, otherwise print out a notification that the two nodes are not connected.

An earlier version of this exercise used the JgraphT library. Some of the ideas have been retained.

The source code, and supporting IDE files, were created in JetBrains IntelliJ 2018.1 IDE.

About

This is an application that demonstrates searching for the shortest path in a directed graph.


Languages

Language:Java 100.0%