![Page 1: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/1.jpg)
Computational Movement Analysis
Lecture 2: Clustering
Joachim Gudmundsson
![Page 2: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/2.jpg)
Fundamental tools: clustering
Clustering: Group similar objects into clusters.
![Page 3: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/3.jpg)
Fundamental tools: clustering
Clustering: Group similar (sub)curves into clusters. Similarity measure: Fréchet distance
Question: Do we need any constraints on a cluster? Constraints on subcurves in a cluster?
![Page 4: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/4.jpg)
Aim: Cluster subcurves
Cluster of subcurves
![Page 5: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/5.jpg)
Subtrajectory clustering
![Page 6: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/6.jpg)
Subtrajectory clustering
![Page 7: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/7.jpg)
Subtrajectory clustering
![Page 8: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/8.jpg)
Subtrajectory clustering
![Page 9: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/9.jpg)
Recall: Fréchet Distance
Fréchet Distance measures the similarity of two curves.
Dog walking example- Person is walking his dog (person on one curve and the dog on other)- Allowed to control their speeds but not allowed to go backwards!- Fréchet distance of the curves: minimal leash length necessary for
both to walk the curves from beginning to end
![Page 10: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/10.jpg)
Input: Two polygonal chains P=p1, … , pn and Q=q1, … , qm in Rd.
The Fréchet distance between P and Q is:
where and range over all continuous non-decreasing reparametrizations.
Note that (0)=p1, (1)=pn, (0)=q1 and (1)=qm.
Well-suited for the comparison of curves since it takes the continuity of the curves into account.
Recall: Fréchet Distance
(P,Q) =
![Page 11: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/11.jpg)
Decision algorithm: compute path
Algorithm: 1. Compute Free Space diagram mn cells O(mn) time 2. Compute a non-xy-decreasing path from (q1,p1) to (qm,pn). Build network O(mn) time. Find a path O(mn) time.
(q1,p1)
(qm,pn)
P
Q
![Page 12: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/12.jpg)
Cluster
Input: A polygonal curve T, an integer m>1 and a distance d.
Cluster: m subcurves T1, … , Tm of T with distance at most d between any two subcurves.
Constraints?
![Page 13: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/13.jpg)
Cluster
Input: A polygonal curve T, an integer m>1 and a distance d.
Cluster: m subcurves T1, … , Tm of T with distance at most d between any two subcurves.
Constraint 1: subcurves are pairwise disjoint
![Page 14: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/14.jpg)
Cluster
Input: A polygonal curve T, an integer m>1 and a distance d.
Cluster: m subcurves T1, … , Tm of T with distance at most d between any two subcurves.
Constraint 1: subcurves are pairwise disjoint
More constraints?
d infinite number of clusters
![Page 15: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/15.jpg)
Cluster
Input: A polygonal curve T, an integer m>1 and a distance d.
Cluster: m subcurves T1, … , Tm of T with distance at most d between any two subcurves.
Constraint 1: subcurves are pairwise disjoint
Constraint 2: cluster has to be maximal “length”
d infinite number of clusters
![Page 16: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/16.jpg)
Decision Problem
Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T1, … , Tm of T such that:1. the subcurves are pairwise disjoint, 2. the distance between any two subcurves is at most d,
and 3. at least one subcurve has length l.
![Page 17: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/17.jpg)
Decision Problem
Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T1, … , Tm of T such that:1. the subcurves are pairwise disjoint, 2. the distance between any two subcurves is at most d,
and 3. at least one subcurve has length l.
![Page 18: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/18.jpg)
Decision Problem
Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T1, … , Tm of T such that:1. the subcurves are pairwise disjoint, 2. the distance between any two subcurves is at most d,
and 3. at least one subcurve has length l.
The length of a subcurve cluster is assumed to be maximal.
![Page 19: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/19.jpg)
Decision Problem
Given a curve T, a subcurve cluster SC(m,l,d) of T consists of at least m subcurves T1, … , Tm of T such that:1. the subcurves are pairwise disjoint, 2. the distance between any two subcurves is at most d,
and 3. at least one subcurve has length l.
The length of a subcurve cluster is assumed to be maximal.
![Page 20: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/20.jpg)
Decision Problem
Given a trajectory T, a subtrajectory cluster SC(m,l,d) of T consists of at least m subtrajectories T1, … , Tm of T such that:1. the subtrajectories are pairwise disjoint, 2. the distance between any two subtrajectories is at
most d, and 3. at least one subtrajectory has length l.
The length of a subtrajectory cluster is assumed to be maximal.
![Page 21: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/21.jpg)
Problem
Decision version: Subtrajectory cluster SC(m,l,d)
Given a trajectory T, is there a subtrajectory cluster with parameters m, l and d?
Optimisation versions: SC(m,max,d) – maximise length of
cluster
![Page 22: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/22.jpg)
Hardness results
Theorem 1: Finding any approximation of the SC(m,max,d) problem is 3SUM-hard.
Theorem 2: The decision problem SC(m,l,d) is NP-complete.
Theorem 3: The problem of computing a (2-)-distance approximation of the SC(m,max,d)-problem is NP-hard.
[Gudmundsson & van Kreveld’08]
![Page 23: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/23.jpg)
Hardness results
Theorem 2: The decision problem SC(m,l,d) is NP-complete.
Reduction from MaxClique
MaxClique:Is there a clique of size k in a given graph G=(V,E)?
Clique of size 4
![Page 24: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/24.jpg)
Longest subtrajectory cluster: NP-complete
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
![Page 25: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/25.jpg)
Longest subtrajectory cluster: NP-complete
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
![Page 26: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/26.jpg)
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
Longest subtrajectory cluster: NP-complete
![Page 27: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/27.jpg)
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
Longest subtrajectory cluster: NP-complete
![Page 28: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/28.jpg)
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
Longest subtrajectory cluster: NP-complete
![Page 29: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/29.jpg)
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
Longest subtrajectory cluster: NP-complete
![Page 30: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/30.jpg)
Problem: SC(m,l=n,d).
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
b,c,d
a
e
Longest subtrajectory cluster: NP-complete
![Page 31: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/31.jpg)
Problem: SC(m,l=n,d).
a
b,c,d
e
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
Longest subtrajectory cluster: NP-complete
![Page 32: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/32.jpg)
a
b
c
d
e
MaxClique
SC(m,l=n,d) Clique of size m in G Problem as hard as
MaxClique!
b,c,d
e
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
Longest subtrajectory cluster: NP-complete
Problem: SC(m,l=n,d).
![Page 33: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/33.jpg)
Hardness results
Theorem 2: The decision problem SC(m,l,d) is NP-complete.
![Page 34: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/34.jpg)
Problem: SC(m,l=n,d).
a
b,c,d
e
b
a,c,e
d
c
a,b
d,e
a,e
b,c
d
b,d
a,c
ea
b
c
d
e
MaxClique
Longest subtrajectory cluster: NP-complete
![Page 35: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/35.jpg)
Hardness results
Theorem 3: The problem of computing a (2-)-distance approximation of the SC(m,max,d)-problem is NP-hard.
![Page 36: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/36.jpg)
Hardness results
Theorem 3: The problem of computing a (2-)-distance approximation of the SC(m,max,d)-problem is NP-hard.
Corollary 1: The problem of computing a (2-)-distance approximation of SC(max, l, r), for any constant 0 < < 1, is at least as hard as approximating MaxClique.
![Page 37: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/37.jpg)
Hardness results
Theorem 3: The problem of computing a (2-)-distance approximation of the SC(m,max,d)-problem is NP-hard.
Corollary 1: The problem of computing a (2-)-distance approximation of SC(max, l, r), for any constant 0 < < 1, is at least as hard as approximating MaxClique.
Can we find a 2-distance approximation in polynomial time?
![Page 38: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/38.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
The Fréchet distance of F can be computed by computing the Fréchet distance between every pair of curves.
Time: O( (ninj log ninj))i,j
If |Fi| = n/m then O((n/m)4 log n/m).
![Page 39: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/39.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
Observation: Given F1, F2 and F3, we have: F(F1,F3) F(F1,F2) + F(F2,F3).
[Dumitrescu & Rote’04]
![Page 40: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/40.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
Observation: Given F1, F2 and F3, we have: F(F1,F3) F(F1,F2) + F(F2,F3).
Can we use this observation to get an approximation?
a
b
a+b
[Dumitrescu & Rote’04]
![Page 41: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/41.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
Idea: Select a representative curve F1 of F.
Compute the maximum Fréchet distance D between F1 and all other curves in F.
![Page 42: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/42.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
Idea: Select a representative curve F1 of F.
Compute the maximum Fréchet distance D between F1 and all other curves in F.
D F 2D
Observation: Gives a 2-approximation
![Page 43: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/43.jpg)
Fréchet distance between m curves
Input: Set of m polygonal curves F = {F1, …, Fm} with |Fi| = ni
Idea: Select a representative curve F1 of F.
Compute the maximum Frechet distance D between F1 and all other curves in F.
D F 2D
Observation: Gives a 2-approximation
Time: O( (n1ni log n1ni))i
![Page 44: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/44.jpg)
Decision algorithm: compute path
Recall: Deciding if the Fréchet distance between two curves P and Q is less than r can be computed in O(mn) time.
The Fréchet distance between two polygonal curves P and Q can be computed in O(mn log mn) time using parametric search.
(q1,p1)
(qm,pn)
P
Q
Q P
![Page 45: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/45.jpg)
Recall the problem
Given a trajectory T, a subtrajectory cluster SC(m,l,d) of T consists of at least m subtrajectories T1, … , Tm of T such that:1. the subtrajectories are pairwise disjoint, 2. the distance between any two subtrajectories is
at most d, and 3. at least one subtrajectory has length l.
![Page 46: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/46.jpg)
Recall the problem
Constraint: For simplicity we will assume that all sub-trajectories in a cluster has to start and end at a vertex.
Input: A trajectory T with n points, an integer m>1 and a real value d>0.
Output: SC(m,max,d)
Idea: Create a free space diagram describing the distance between T and T.
![Page 47: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/47.jpg)
Free space diagram of T
T
![Page 48: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/48.jpg)
Free space diagram of T
T
![Page 49: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/49.jpg)
Free space diagram of T
TA
B
C
D(A,C) d D(B,C) d D(A,B) 2d
![Page 50: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/50.jpg)
Free space diagram of T
A
B
C
C: representative trajectory
The length of the SC {A,B,C}is the length of the representative trajectory.
![Page 51: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/51.jpg)
Free space diagram of T
![Page 52: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/52.jpg)
Free space diagram of T
![Page 53: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/53.jpg)
Free space diagram of T
![Page 54: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/54.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
LR
While sweeping maintain network of critical points.
![Page 55: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/55.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 56: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/56.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
LR
![Page 57: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/57.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
LR
![Page 58: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/58.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
LR
![Page 59: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/59.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
LR
![Page 60: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/60.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 61: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/61.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 62: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/62.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 63: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/63.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 64: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/64.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 65: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/65.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 66: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/66.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
LR
![Page 67: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/67.jpg)
Approximation algorithm
1. Sweep the free space diagram from left to right with two vertical lines (L and R)
2. At each event point decide if there are m monotone curves between L and R
a) If “yes” then move R to the right
b) If “no” and R-L=1 then move R to the right
the rightc) If “no” and R-L>1 then
move L to the right
L R
![Page 68: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/68.jpg)
Data structures
Number of event points? LR
![Page 69: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/69.jpg)
Data structures
Number of event points? L R
![Page 70: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/70.jpg)
Data structures
Number of event points? O(n)L R
Two types of events: 1. L moves to the right2. R moves to the right
How to handle an event?
Decide if there are m non-overlapping xy-monotone paths between L and R
![Page 71: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/71.jpg)
Handle event
Start with top-most corner u on R.
Find the top-most corner u’ on L that can be reached by a xy-monotone path P.
L R
Observation: No point on R below u can reach a point on L above u’ with an xy-monotone path.
P
u’
u
![Page 72: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/72.jpg)
Handle event
L R
P
u’
u
vv’
Start with top-most corner u on R.
Find the top-most corner u’ on L that can be reached by a xy-monotone path P.
Observation: No point on R below u can reach a point on L above u’ with an xy-monotone path.
![Page 73: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/73.jpg)
Handle event
L R
Next take the top-most corner v on R below u’. Find the top-most corner on L that can be reached by a xy-monotone path.
Continue until:1. m curves found, or 2. no more corners on R.
P
u’
u
v
v’
Start with top-most corner u on R.
Find the top-most corner u’ on L that can be reached by a xy-monotone path P.
![Page 74: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/74.jpg)
Path Query in the Free Space diagram
Recall querying for a path in lecture 1.
O(n2) time per query
O(n) events, n points on RTotal: O(n3w) time and O(nw) space, where w = max (R-L)
In worst case the algorithm performs n path queries.
How do we perform a path query?
![Page 75: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/75.jpg)
Path Query in the Free Space diagram
Can it be improved?
In worst case the algorithm performs n path queries.
How do we perform a path query?
O(n2w) time and O(nw) space
![Page 76: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/76.jpg)
L R
Path Query in the Free Space diagram
Can it be improved?
In worst case the algorithm performs n path queries.
How do we perform a path query?
O(n2w) time and O(nw) space
Extension:The algorithm can be modified to handle the case when only the “reference” trajectory needs to start an end at vertex.
![Page 77: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/77.jpg)
Approximation algorithm
Theorem:A 2-distance approximation of the SC(m,max,d) problem can be computed in O(n2+nmw) time and O(nw) space using the discrete Fréchet distance.
Theorem:A 2-distance approximation of the SC(m,max,d) problem can be computed in time O(n2w) using the continuous Fréchet distance if reference trajectory starts and ends in vertex.
Theorem:A 2-distance approximation of the SC(m,max,d) problem can be computed in time O(n3m 2(n/m)(log2 n+m)) using the continuous Fréchet distance.
[Joint work: Buchin, Buchin, Löffler and Luo’10]
![Page 78: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/78.jpg)
Experimental Results (continuous!)
Note: Continuous model input data can be simplified![Joint work with Nacho
Valladares’13]
i5-200 CPU witha Nvidia GTX 580
![Page 79: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/79.jpg)
Open Problems
1. Can we cluster faster?
2. Can a c-approximate Fréchet clustering be computed faster?
3. Can we cluster faster for special cases?
4. What should we report?
5. Cluster using other distance measures? For example using [Sankaramanet al. 2013]?
![Page 80: Computational Movement Analysis Lecture 2: Clustering Joachim Gudmundsson](https://reader036.vdocuments.site/reader036/viewer/2022062520/5681649f550346895dd68c6c/html5/thumbnails/80.jpg)
References
• K. Buchin, M. Buchin, J. Gudmundsson, M. Loffler and J. Luo. Detecting Commuting Patterns by Clustering Subtrajectories. International Journal on Computational Geometry and Applications, 2011.
• N. Valladares and J. Gudmundsson. A GPU approach to subtrajectory clustering using the Fréchet distance. ACM SIGSPATIAL 2012.
• A. Dumitrescu and G. Rote. On the Fréchet distance of a set of curves, Proceedings of the Sixteenth Canadian Conference on Computational Geometry, 2004.
• S. Sankararaman, P. K. Agarwal, T. Mølhave, J. Pan and A. P. Boedihardjo. Model-driven matching and segmentation of trajectories. ACM SIGSPATIAL, 2013