275 points · by digital55 · 8y ago · 62 comments
That's a kind of practical graph where you want efficient shortest path algorithms for.
https://www.telegraph.co.uk/money/consumer-affairs/fare-spli...
https://www.bbc.co.uk/news/uk-england-19217111
and there are web sites which do split ticketing:
http://www.raileasy.co.uk/home/split-ticketing/
I know that something similar happens with airplane tickets but they get you with the luggage and with terms & conditions AFAIK.
How is it similar/different with train tickets?
But the most confusing part is the ring topology (here shown with the zone-ring center being the actual city center):
https://passagerpulsen.taenk.dk/sites/default/files/styles/f...
When buying 2-8 zones you don't pay for individual zones, but rather rings from your origin zone. Going one way, the zone rings look one way. Going back they look different, because the origin zone is different.
A practical example of this peculiarity:
You go from Hellerup (zone 2) to Friheden (zone 33) via the central station (zone 1). Your ring 0 is zone 2, and zone 1 and 33 are both in ring 1, so you only pay for two zone(-ring)s: https://dinoffentligetransport.dk/media/1413/svanemollen-fri...
You go back from Friheden to Hellerup via the central station: Your ring 0 is zone 33, zone 2 is in ring 1, but zone 1 is in ring 2 this time, so you pay for three zone(-ring)s: https://dinoffentligetransport.dk/media/1411/friheden-svanem...
Your origin zone on the way out was adjacent to both other zones needed (needing only 1 ring), but your origin zone on the way back was not (needing 2 rings).
So they're not just different prices: The graph that spans train stations via zones in the ring topology is not metric. So getting a return ticket is not the inverse of getting the ticket out. And while you have a ticket that's valid for the timespan of your return, it may not be valid for your return path.
In the US, on Amtrak, a ticket is specific to an exact train, like buying a plane ticket. There's no generalized "I want a ticket from DC to NYC."
You might have a major city, A, a center of finance and law and full of corporate headquarters, and a smaller city, B, where many of the companies whose headquarters are in A have their engineering and manufacturing facilities.
Someone making a deal with one of those companies may need to visit both engineering to work out technical details first and then visit headquarters to work out business, financial, and legal details. They will travel from home to B, and then travel to A, and then when done travel directly home from A. This may happen much more than the other direction--people needing to visit headquarters first and then going to visit engineering and manufacturing, without needing to go back to headquarters.
Net result: more passengers needing B to A than A to B. This can result in A to B trips having empty seats. It might even result in some trips with no passengers at all! They can't simply cancel those trips, because they need to get the vehicles to B to handle the B to A traffic, so they sell seats cheap.
This creates the asymmetry
A round-trip can be cheaper depending on direction of travel.
One-way trip can be significantly cheaper if you are flying through a major hub like FRA and starting your journey from a less wealthy country.
That would be a metric space, and a distance obey the triangle inequality by definition. The element of the space are otherwise quite arbitrary.
Unfortunately, Normed spaces are a subset of metric spaces which are much less general (in particular they have to be vector spaces).
Also, a math correction: spaces which obey the triangle inequality are called metric spaces. The class of normed spaces is more restricted, but still very large.
A graph G is a distance(k)-expander if #edges(U, V-U) > c min(#U,#(V-U)) where U is a set of diameter <=k. Now study the embeding.
I am also curious about what happens if one use SVM to classify vertices of an expander graph: Let G be an expander graph and let u1,u2 be vertices of G such that d(u1,u2) = diameter of G = an even number 2k. We classify the vertices of G like this: f(u) = 0 if d(u,u1)<=k, f(u)=1 if d(u,u1)>=1, then using SVM applied to the vertices encoded by the rows of the adjancecy matrix. I would expect the SVM algorith to have some special property but I don't know what to expect, the best or worst classification, or the support vectors can gives us some information about symmetries in the graph.
(Thanks for the correction. I just gave one of the properties, but should’ve been more precise.)
It's interesting that this is called Manhattan distance because it's only relevant in a town where everyone jaywalks... Like Manhattan. It's far from true anywhere where jaywalking is frowned upon.
Because of (the lack of) crosswalk synchronization, it's a lot faster to walk to a place 2 blocks over and 2 blocks up than it is to walk to a place 4 blocks in one direction. Because at the first two lights you have the option of crossing in either direction, at which point you may only have to wait a few moments before crossing in the other direction.
I had exactly the same thought about crossing streets when reading one of his books. Always choose a route where you have the choice to keep walking in some direction towards your destination, with a delayed jaywalk to cross to the side you want during a gap in traffic, rather than wait on a corner when a crossing is blocked. The reason for blockage can be a crosswalk light (if you obey them) or traffic itself - the rule applies even without any signal-controlled junctions.
There are currently a ton of mediocre ways to do this because nothing really works very well in high dimensions, and calculating this can easily be the bottleneck in training and evaluation.
Two problems that have to do with k-NN are
1. It's a non-parametric method: the number of parameters grow linearly with the size of the training set since the distance function must be calculated for all training points and the test point.
2. The curse of dimensionality: distance metrics like the Euclidean distance do not perform well in higher dimensions; points which seem "close" in 2D may be far in 3D, 4D, etc. As a result, we would need an exponential amount of more training data for every additional dimension. Locality sensitive hashing tries to combat this by reducing the dimensionality of the data.
Edit: The author says its https://ilyaraz.org/static/papers/daher.pdf, but he got marked dead by HN.