Giter Club home page Giter Club logo

hw6-sol's Introduction

HW6 example solution

This is an example solution for STEP HW6, implemented in Go.

Part 1:

Part 2:

Ther's two choices for priorities in routing: least transfers, or least stations in the path.

To compute the "least stations" path, it's simply computed via BFS over the train station network.

To compute the "least transfers" path, the train station network graph is transformed into an atlernate graph where all of the stations on the same line share an edge. On this graph, a shortest BFS path finds the stations where transfers should happen. Then between each of these "landmark stations", BFS is used again over the single line used between those "landmark stations" to enumerate a stations between them.

For example this adjacency graph for Tokyo:

Tokyo adjacency

And the corresponding line adjacency graph where stations on the same line are connected:

Tokyo adjacency

hw6-sol's People

Contributors

step17 avatar

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.