How to find all equals paths in degenerate tree from specific start vertex?

If I have a set of points defining a particular path, and I have a set of such paths such that these paths deviate from each other only slightly then how do I find the mean path?

  • Something like this - Sorry about the bad paint drawing. So I have the above paths. They are relatively close to each other or you can say follow the same pattern. How do I find the mean path?

  • Answer:

    Let's say you have four paths, p, q, r and s. If the paths are "time-stamped" (parametrized in time), you can simply take the average point at each time, i.e. (p(t)+q(t)+r(t)+s(t))/4 If you don't have exact timestamps: this means that you don't know which points from p, q, r and s are to be averaged together. Then you need to "align" the paths in time. Maybe the most effective tool to do this is to use http://en.wikipedia.org/wiki/Dynamic_time_warping, which finds the "best" alignment between two sequences. You can use DTW, with using Euclidean distance as cost, to find the alignment between a pair of sequences, then take the averages. One remaining problem is that DTW only finds a matching between a pair of sequences. If you have multiple sequences, you can proceed in a "tournament-like" manner (match p and q to produce the average pq, match r and s to produce the average rs, match pq and rs to produce the final answer), or there are other variants. The wikipedia page on DTW contains some information and links for them.

Jun-Geun Park at Quora Visit the source

Was this solution helpful to you?

Other answers

Assuming the points are not related to any real world sensor input, but mathematical and perhaps arbitrary, and, further, assuming that you have, effectively a set of values for y corresponding to one value of x, then a way to do it is to take an average of the values of y, calculate the differences between the average and each point, process these values in some way and then adjust the position of the 'average' to minimise the value of the sum. Often you will choose to use the sums of the squares, if you prefer, thus giving more importance to the points which deviate furthest from the average. There are a whole raft of algorithms and mathematical tools to do this job, mostly with an emphasis on reliable prediction of the next value in a series, but with a bit of manipulation you can use the logic to solve your problem. Of course, if the lines are derived from a sensor, a good trick is to analyse your input to make sure it is sensible. For example; input from a sensor which indicates that the pressure in a 60tonne tank rose by 100psi per second for three seconds and then, just as abruptly fell back again would, perhaps, be a mite suspect. Engineering common sense always trumps mathematical theory!

Michael Grainger

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.