asked on # C++ Graphs (Logic)

Please do not post links, code, algorithms, or copy another reference unless directly related to my question. I am looking to understand a certain aspect, and this aspect only.

I am trying to fully understand graphs in C++. I am trying to understand how to get the shortest distance from point A in a graph to point B. However, let's say our graph is a graph of a city, or country, or bigger. Now if we want to get the shortest distance from point A to point B we have a problem. The problem is that there are billions of streets and different ways to go and the user wants a response quickly, what can we do?

Do graphs have to be created in a way that basic assumptions can be made? For example south-west to north-east, would you want to assume north over south west over east?

Can you ever get THE shortest way or do you have to settle?

I think from this you can understand where my confusion lies, I do not require specific answers to specific questions, simply see my confusion and guide me if you can, please.

I am trying to fully understand graphs in C++. I am trying to understand how to get the shortest distance from point A in a graph to point B. However, let's say our graph is a graph of a city, or country, or bigger. Now if we want to get the shortest distance from point A to point B we have a problem. The problem is that there are billions of streets and different ways to go and the user wants a response quickly, what can we do?

Do graphs have to be created in a way that basic assumptions can be made? For example south-west to north-east, would you want to assume north over south west over east?

Can you ever get THE shortest way or do you have to settle?

I think from this you can understand where my confusion lies, I do not require specific answers to specific questions, simply see my confusion and guide me if you can, please.

Editors IDEsProgramming

Log in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a question
So then, what is the most common usage for a graph and why?

The following is a link to "Graphs and their Uses", a book by Oystein Ore, on Amazon.com for $27.30 (used $9.94). It is well worth the reading and will provide answers to your questions much better than any dialog on this forum.

http://www.amazon.com/Graphs-their-Uses-Mathematical-Library/dp/0883856352#noop

http://www.amazon.com/Graphs-their-Uses-Mathematical-Library/dp/0883856352#noop

Log in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a question
If you google for "shortest path problem C++" you got a lot of solutions, e. g. at

http://ds4beginners.wordpress.com/2006/12/17/code-2-for-dijkstras-shortest-path-algorithm-in-c/

http://ds4beginners.wordpress.com/2006/12/17/code-2-for-dijkstras-shortest-path-algorithm-in-c/

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!

James Murphy