Jump Point Search final path - path-finding

I have been studying the Jump Point Search(JPS) path-finding algorithm recently but I do not fully understand how the final path is chosen.
In A* all the parent nodes are in the closed list and after the goal becomes a parent it tracks back through the closed list. The path will not be calculated until the goal node becomes a parent node in the closed list which will then track back through the parent nodes in the closed list that it is related to.
So how does JPS achieve this if it jumps over most of the nodes in the grid. A* works back through each node it has calculated but JPS can't do this can it?
JPS doesn't have a list of parent nodes in the closed list so does it just connect the path from one node to another ie. it draws a line from one node to another node which is five nodes away rather than a line from one node to another?
I have read all of Harabor's and Grastien's papers on the subject so please do not give me links as I do not understand the way they have explained it :)
If you can explain this to me well then you have my many thanks :)

What you need to keep in mind is that JPS is still A*. The only difference is that instead of always expanding all the neighbors of the current node, it only considers a subset of them.
As such, you stil need to keep track of the parents of jump nodes. Here you have to think of a parent as the node you have to go through to reach the current node. In A*, this will always be an adjacent node. In JPS this will often be a node many steps ahead of you. These steps, however, will always be along one specific movement vector. To find the'path' between the node and its parent you just have to keep taking steps from one to the other according to the normalized movement vector between them.
For example you have a node (5,3) with parent (2,0). node - parent gives you (3,3), which normalized gives you the step (1,1). In this case, taking 3 diagonal steps along (1,1), or in other words to positive x and positive y, brings you from parent to node.

Related

How to clone a graph without modification of inital one?

How to clone a graph if:
nodes are not labeled
it's only possible to move between nodes through edges
you can't mark or any other way use nodes of original graph
More precise definition of problem:
You are navigating through graph.
At a time you see only one node and it's links. For example as simple as single number (number of links).
Graph is non-directed with unique links between each connected pair of nodes.
To move to another node you just pass a link index into step API call and get next node (number of links in next node). Function step handles moves in a way like list of links is sorted same way every time you enter the node. E.g. if you are in node A connected with node B then passing some constant number i_A_B into step always get you into node B.
At start you are in special start node that has only one connection, then you can only pass "0" into and get into start node. This is an equivalent to call special start API call without parameters and get into start node.
Is there any and what is the well-known name of this problem?
What is the algorithm that can make a clone of graph without modifying (marking, labeling, coloring) the original one?
Creating nodes during navigation and connect them to previous node is trivial.
The main difficulty then obviously would be to match already visited nodes with already created.
What minimal additional information is required?
Is marked initial node is enough?
For example without mark any cycle graph will look equivalent through this API. Also any graph with same regular structure but different size.
What types of graphs can be recognized (cloned) without marked start node?
Upd1: API provides no way to compare nodes or edges of original graph.
Upd2: This problem looks like creation of a map of a maze while walking inside it.
Or like replication of a state machine that is encapsulated in black box and provides only oracle that returns a set of acceptable inputs on call with current acceptable input.

How can I force vis.js edges in a rendered DAG to "jump" graph levels?

I have used vis.js to draw some DAGs using the hierarchical layout option. It works well, however for my use case there are often going to be edges that must "jump vertex generations," not certain if I am saying that properly. Essentially, one branch may have 10 levels, and then a sibling of the parent of the deep branch may want to connect to the deepest leaf node.
This "works" - vis.js draws it. But it screws up my layout, shifting a large portion of the preexisting graph, and it will not be useful for a user to look at the result. I have attached a picture of what I am trying to achieve and what the current results are, can anyone point me in the right direction?
Solution turned out to be very simple, I just overlooked it. Using the hierarchical layout, it is possible to assign each node a field called level. It is an all-or-nothing option: either you let vis.js take care of the levels, or you manually assign all your nodes a level. It respects the levels very well, and when adding edges to nodes whose levels have been manually defined, the nodes no longer jump around the layout.

immutable functional data structure to represent graphs

I (almost) fully understand the Zipper data structure for trees. However, in some publications I saw hints that it is also possible to use the Zipper idea to create immutable functional data structure for arbitrary graphs (which might have cycles as well).
What's the way to do it?
As soon as we have cycles, it means that any node can be reached via several paths. Hence, if I focus on a node, do some change to it, and move the focus away, I might later on come back to the same node via a different path, which means that it would be an 'old' version of the node, prior to the change made.
The only solution I came up with is to include to the context the list of changes to any node. Every time before the focus is changed to node X, it should be checked whether X is the member of the list of changes, and if so, it should be taken as the focused node.
If we also track the number of times N node X was copied from the list of changes, we can remove X from the list of changes, as soon as N = number of edges, inward to X.
Is there any better way to do it?

Can a spanning tree contain a self loop?

I am referring to explanation of spanning tree given here.
I want to know can a spanning tree contain self loop? I.e. edge from one vertex to itself? I guess, no; because then for that loop there are two paths to reach that node. one direct and one including loop, but I want to confirm.
According to the Wikipedia article about trees, a tree is required to be cycle-free, which consequentially also holds for a spanning tree.

Can a network of nodes (graph) be represented as one or more trees?

When I convert my graph into trees I don't mind having duplicate nodes in the trees. let me explain the reverse way. Suppose I have 2 trees with a common element. I can join them on the common element to create a graph.
Can I do this in the opposite direction, i.e., start with the graph and split an element into duplicates to create multiple trees?
If I understand correctly, you want a tree containing all the links from the original, by allowing original nodes to appear several times in this tree. It's some kind of spanning tree, except the constraint is on keeping all links (instead of keeping all nodes, as in a classic spanning tree).
So you can use a similar approach than those used for discovering classic spanning trees. The basic approach is based on either breadth- or depth-first search. You start from a random node, and you add it to your tree. You then explore its neighbors using the search algorithm, and each time you reach a node, you add it to your tree (with the corresponding link). You must maintain a list of all processed links, so that you don't end up treating the same link twice. Also, you need a way to identify each node uniquely, to allow subsequent processing on your tree. For instance, simply number the nodes in your original graph.

Resources