Giter Site home page Giter Site logo

networkpath's Introduction

Network Path Test

Imagine that there is a small network with a number of interconnected devices. Each connection has a latency parameter which is expressed in milliseconds. Your task is to write a program that will determine whether a signal can travel between two devices in a given amount of time or less.

Implementation Guidelines

  1. The program should be executable from command line and accept one parameter - csv file path.

  2. CSV file structure:

    Format: Device From, Device To, Latency (milliseconds)
    Contents:
    A,B,10 
    A,C,20 
    B,D,100 
    C,D,30 
    D,E,10 
    E,F,1000
    
  3. The program should then continually wait for user input. Format should be [Device From] [Device To] [Time] (e.g A F 1000 followed by ENTER key). If the signal can travel from A to F in 1000ms or less then output the signal path and total travel time in milliseconds otherwise print "Path not found". If user enters QUIT then terminate the program.

  4. You are only required to output first path that meets the time constraint. It does not have to be the shortest path.

  • Hints: Think of the best data structure to accommodate devices and connections and write your code accordingly.

Usage

$ composer install
$ php run.php [CSV FILE] 

Test with including sample

$ php run.php sample_data.csv 

Test with Docker

$ docker build -t app . 
$ docker run --rm -it -v $(pwd):/app -w /app app composer install && php run.php sample_data.csv

networkpath's People

Contributors

jay74jung avatar xyzcocktail avatar

Watchers

 avatar

Forkers

rinkal-patel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.