# Pilot a Rocket

You work for RocketX, a company that is going to send the first humans to colonize Mars. It is your job to write the algorithm that will connect the base on Earth to the space ship through a series of satellites to send instructions to pilot the rocket. It's important to connect to it quickly, so we need to find the shortest path from the base to the ship.

Given a graph data structure representing satellites, find the shortest path through the satellites to reach the target. You can always assume there will only be one shortest path.

The starting node will always be `base`

and the ending node will be `ship`

.
If the ship can't be reached, return `null`

.

**Write a function pilotRocket that takes a satellites input graph and returns an array of satellite IDs in the order that reaches the ship in the shortest path.**

` `

## Breakdown

Table of Contents

### Validate My Answer

There are two ways to traverse graphs, but only one of the methods guarantees you'll use the shortest path.

Make sure your search algorithm doesn't get caught in a graph cycle.

Make sure your solution doesn't print in reverse order.

Make sure you handle the case when there is no path to the final node.

This can be solved in

*O(V + E)*time where V is the number of vertices and E is the number of edges.

Table of Contents

Test Results

Run your code and see results here...

### Pilot a Rocket

Given a graph data structure representing satellites, find the shortest path through the satellites to reach the target. You can always assume there will only be one shortest path.

The starting node will always be `base`

and the ending node will be `ship`

.
If the ship can't be reached, return `null`

.

**Write a function pilotRocket that takes a satellites input graph and returns an array of satellite IDs in the order that reaches the ship in the shortest path.**

` `