[Q] How should I assign distance values to a fixed graph?

Page 1 of 1

4 Replies - 631 Views - Last Post: 28 April 2014 - 10:34 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=345856&amp;s=13801ea8646163df0e3c5d206391f277&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 M-rhodes

Reputation: 1
• Posts: 133
• Joined: 24-September 10

[Q] How should I assign distance values to a fixed graph?

Posted 28 April 2014 - 10:05 AM

Hi guys,

I'm working on a Dijkstra's algorithm with a fixed graph. My question is, how should I go about assign distance values to the graph. The user can start from any node.

All help is appreciated.

Is This A Good Question/Topic? 0

Replies To: [Q] How should I assign distance values to a fixed graph?

#2 modi123_1

• Suitor #2

Reputation: 10840
• Posts: 42,465
• Joined: 12-June 08

Re: [Q] How should I assign distance values to a fixed graph?

Posted 28 April 2014 - 10:15 AM

It seems straight forward.. for any given node the value of distance to any neighboring 8 cells is '1'.

#3 M-rhodes

Reputation: 1
• Posts: 133
• Joined: 24-September 10

Re: [Q] How should I assign distance values to a fixed graph?

Posted 28 April 2014 - 10:28 AM

modi123_1, on 28 April 2014 - 10:15 AM, said:

It seems straight forward.. for any given node the value of distance to any neighboring 8 cells is '1'.

Thanks for the response! To confirm, do you mean that all neighbouring nodes to the start node are 1 and outer nodes increase?

For example, if M is the start node, G,H,I,L,N,Q,R,S, are 1 away from M?

Apologies if my response is a little ambiguous, I'm quite tired today.

#4 modi123_1

• Suitor #2

Reputation: 10840
• Posts: 42,465
• Joined: 12-June 08

Re: [Q] How should I assign distance values to a fixed graph?

Posted 28 April 2014 - 10:32 AM

How ever you want to divide or number, but yeah.. any immediate neighbor to the node is '1' distance away.

#5 M-rhodes

Reputation: 1
• Posts: 133
• Joined: 24-September 10

Re: [Q] How should I assign distance values to a fixed graph?

Posted 28 April 2014 - 10:34 AM

modi123_1, on 28 April 2014 - 10:32 AM, said:

How ever you want to divide or number, but yeah.. any immediate neighbor to the node is '1' distance away.

Thanks for confirming. I tried to +rep you, but I keep getting sent to the top of the page.