Advertisement

pathfinding a*

Started by March 26, 2008 01:20 PM
25 comments, last by travikk 16 years, 8 months ago
Quote: Are you just interested in the shortest number of nodes touched? While not coordinates, that's still a distance metric (all traversals == cost of 1)


Yea, that's exactly what i expect.
@Emargent: thanks for link, will check it out in a minute.
Quote: Original post by travikk
Yes, they don't have any coordinates.
Lol, guys this post is going so fast... ;-)


You know the old joke about why the multithreaded chicken crossed the road? This thread feels like that...
Advertisement
Quote: Original post by Emergent
Quote: Original post by travikk
Yes, they don't have any coordinates.
Lol, guys this post is going so fast... ;-)


You know the old joke about why the multithreaded chicken crossed the road? This thread feels like that...


Um, I belive I don't... Enlight me? ;p
As far as I feel - it's good to have such a communicty, where you don't have to wait for a weeks for one single answer, isn't is?
Quote: Original post by travikk
Quote: Original post by Emergent
Quote: Original post by travikk
Yes, they don't have any coordinates.
Lol, guys this post is going so fast... ;-)


You know the old joke about why the multithreaded chicken crossed the road? This thread feels like that...


Um, I belive I don't... Enlight me? ;p
As far as I feel - it's good to have such a communicty, where you don't have to wait for a weeks for one single answer, isn't is?


Oh! About that chicken...

Quote:
Q)Why did the multithreaded chicken cross the road?
A)to To other side. get the

Q)Why did the multithreaded chicken cross the road?
A)other to side. To the get


And yeah, I'm a big fan of gamedev.net. Been reading it on-and-off since high school. If more people found places like this, more people would enjoy math!
Okay, since I have the right algo, lets think about how to put ~500 diagram elements into a program. What would you suggest?

Having multi-dimensional array, which each one contains those, which can acces isn't really optimal way.
class Node{    std::vector<Node*> myLinks;};std::vector<Node*> myNodes;


To search just find the start node in myNodes and then traverse it's myLinks (using your search algo) until you find the end node.

-me
Advertisement
Well i think i got one ;)
Nodes will be stored in XML file, so I think this will be a good way: (example)

<nodeList>	<node name="some name" id="1">		<node name="a node which can be accessed throught node id=1" id="2">			<node name="a node which can be accessed throught node id=2" id="3" />			<node name="a node which can be accessed throught node id=2" id="4" />			<node name="a node which can be accessed throught node id=2" id="5">				<node name="a node which can be accessed throught node id=5" id="6" />			</node>		</node>		<node name+"... id=1" id="7" />	</node></nodeList>

And access through an application. What do you think? I'll be using ActionScript as a language.
Wait, is your graph a tree ?
My graph is illustrated up here:
http://img230.imageshack.us/img230/2171/croppedrj8.gif

Remamber, this is only illustration. Data will be kept in XML file, and will look like post above.

I've managed to code a function that looks for a route to a nodw from a root. Now wondering how to edit it, to look from a specified node to a specified node, and what is more important: how to keep the correct steps.

EDIT:
Right now, I only don't know how to keep the correct track.
Quote: Original post by travikk
My graph is illustrated up here:
http://img230.imageshack.us/img230/2171/croppedrj8.gif

Remamber, this is only illustration. Data will be kept in XML file, and will look like post above.


Do you think we're stupid ? The image represents a non-directed graph with cycles, and the XML file structure you provide represents a directed and acyclic graph (also known as a tree, hence my question). You cannot represent the image with a format like the post above, it's a mathematical impossibility.

Either your image is incorrect, because you certainly have cycles in there and I have no idea how you could represent those with that XML format of yours, or your XML format is incorrect because it represents trees instead of generic graphs.

Quote: I've managed to code a function that looks for a route to a nodw from a root.


Erm... A 'root' is a tree-only concept. A graph (like the one in the image) only contains nodes and edges. So, what, exactly, do you call a root in your image?


This topic is closed to new replies.

Advertisement