public AnonymizedLocation Anonymize(OriginalLocation msc) { SimulateOtherUsers(msc); //Only for the purpose of this prototype. Remove for video var n = AddMessage(msc); var gmMark = _gm.SubGraph(n); var m = LocalKSearch(msc.K, msc, gmMark).ToList(); if (!m.Any()) { return(null); } _im.Remove(msc); _hm.Remove(msc); _gm.RemoveNode(msc); var bbox = Mbr(m); //TODO: Remove for video _im = new MultidimensionalIndex(); _hm = new ExpirationHeap(); _gm = new ConstraintGraph(); return(new AnonymizedLocation { Id = msc.Id, LatMin = bbox.MinX, LatMax = bbox.MaxX, LonMin = bbox.MinY, LonMax = bbox.MaxY }); }
private static IEnumerable <OriginalLocation> LocalKSearch(int k, OriginalLocation msc, ConstraintGraph gmMark) { var u = gmMark.Nbr(msc).Where(ms => ms.K <= k).ToList(); if (u.Count() < k - 1) { return(new List <OriginalLocation>()); } var l = 0; while (l != u.Count()) { l = u.Count(); foreach (var ms in new List <OriginalLocation>(u)) { if (gmMark.Nbr(ms).Count() < k - 2) { u.Remove(ms); gmMark.RemoveNode(ms); } } } return(gmMark.FindClique(msc, k)); }