Question
c++ The HYG (Hipparcos, Yale, Gliese) Database (v2.0) is a compilation of interesting stellar data from a variety of catalogs. It is useful for background
c++
The HYG (Hipparcos, Yale, Gliese) Database (v2.0) is a compilation of interesting stellar data from a variety of catalogs. It is useful for background information on all sorts of data: star names, positions, brightnesses, distances, and spectrum information. The HYG Database web site is athttp://www.astronexus.com/node/34.
The current version of the HYG Database is hosted at Github https://github.com/astronexus/HYG- Database. The easiest way to retrieve it is using the Download Zip button on the right side of the web page. Unzipping this file will give you three files: README.md, hygfull.csv, and hygxyz.csv. The hygxyz.csv file is the one we will be using.
Part 1 Read in the HYG Database
You need to use the hygxyz.csv file that contains the x, y, and z rectangular coordinates for each star in the data base.
Part 2 Traversal Algorithm
We want to plan a trip to visit all of the known stars, per the HYG Database, within some specified radius of our solar system. [We're assuming we have a technology that let's us jump instantaneously between stars.]
We don't care about an optimal shortest path between the stars, but we don't want to just randomly jump between stars either. Instead, starting at Sol (our sun), we want to jump to the nearest star (that is within our specified radius of Sol) and continuing to the next nearest star that hasnt been visited until we have visited all of the stars that are within our specified radius of Sol. This greedy algorithm is not guaranteed to give us the shortest path.
Here is a truncated version of the output showing the first 10 and last 10 stars in the traversal with distances in parsecs given to two decimal places.
Reading HYG formatted CSV file named "hygxyz.csv". Found 327 stars within a radius of 10.0 parsecs from Sol.
1
Computing a star traversal using a greedy method. ..Sol -> Proxima Centauri : distance = 1.29, total distance = 1.29 ..Proxima Centauri -> Rigel Kentaurus B : distance = 0.07, total distance = 1.37 ..Rigel Kentaurus B -> Rigel Kentaurus A : distance = 0, total distance = 1.37 ..Rigel Kentaurus A -> Barnard's Star : distance = 1.98, total distance = 3.35 ..Barnard's Star -> Gliese Gl 729 : distance = 1.7, total distance = 5.05 ..Gliese Gl 729 -> Lacaille 8760 : distance = 2.26, total distance = 7.31 ..Lacaille 8760 -> Gliese Gl 832 : distance = 1.28, total distance = 8.59 ..Gliese Gl 832 -> Eps Ind : distance = 1.47, total distance = 10.06 ..Eps Ind -> Lacaille 9352 : distance = 1.44, total distance = 11.5 ..Lacaille 9352 -> Gliese Gl 866 A : distance = 1.25, total distance = 12.75 ... ..Gliese Gl 1 -> Gam Pav : distance = 6.26, total distance = 532.24 ..Gam Pav -> Unnamed Star 31220 : distance = 5.55, total distance = 537.78 ..Unnamed Star 31220 -> Unnamed Star 31215 : distance = 0.39, total distance = 538.18 ..Unnamed Star 31215 -> Gliese GJ 1123 : distance = 1.52, total distance = 539.7 ..Gliese GJ 1123 -> Gliese Gl 367 : distance = 5.23, total distance = 544.93 ..Gliese Gl 367 -> Gliese Gl 358 : distance = 0.87, total distance = 545.79 ..Gliese Gl 358 -> Gliese Gl 318 : distance = 2.34, total distance = 548.13 ..Gliese Gl 318 -> Gliese Gl 357 : distance = 2.57, total distance = 550.7 ..Gliese Gl 357 -> Gliese Gl 283 A : distance = 4.26, total distance = 554.97 ..Gliese Gl 283 A -> Gliese Gl 283 B : distance = 0, total distance = 554.97 Total distance traversed is 554.97 parsecs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started