A simple PHP application to find the feasibility of network path in a given network
- Use PHP args, readline for getting user input
- Use CSV Parser to parse the file
- Use Graph to denote the network
- Use BFS to navigate the graph and find feasibility
- Later found that finding minimum path is better to accommodate all test cases, so refactored it
- Graph is bi-directional but need to be explicitly menionted in csv file.
- For example, the test case
Input: E A 400 Output: E => D => B => A => 120
, it is assumed that E => D will be provided in testfile.csv
- PHP latest stable(7.4 recommended)
- Please clone the directory and run composer install
composer install
-
Once the composer installs, it will dump autoload files as well
-
Then please run the file by
php npf.php testfile.csv
- The above composer should install phpunit in vendor, then for unix systems run
./vendor/bin/phpunit
- Or for windows run
.\vendor\bin\phpunit
Copyrights and All rights reserved to the company this test is taken for.