March 2 - Find Graph Weights for a Mapping Application in Ruby
This guide walks through how to work with a mapping application and apply graph traversal techniques to find the distance for each weight in a graph.
Guide Tasks
- Read Tutorial
- Watch Guide Video
- Complete the Exercise
Video locked
This video is viewable to users with a Bottega Bootcamp license
Already a Bottega Student? Sign In
Summary
Build a method that finds the distance for each weight in a directed graph.
Exercise Description
Given a route on map, that contains stops that have a weight measured between each stop, and the total distance, figure out the value that each weight represents.
Example Route
Example Data
Given the total distance of:
15
And the three nodes, represented by an array:
[[1, 3], [2, 3], [3, 4]]
Expected Output
The value of each weight is:
1.5
Real World Usage
In this exercise, you'll learn how to work with graph analysis. In computer science, graphs give the ability to assign priorities and make connections between data points. Working with applications, such as mapping tools, are a common situation where working with graphs is required knowledge.