Clarify biconnected components description#303
Clarify biconnected components description#303simonlindholm merged 1 commit intokth-competitive-programming:mainfrom
Conversation
Two distinct paths is a very weak statement (as having overlapping paths which differ by just one edge/node are distinct). Internally disjoint is a much more apt description.
|
"Internally disjoint" is not a term I've heard. Can we just swap out distinct for disjoint but otherwise leave the original description intact? |
In formal math/graph theory, internally disjoint is the term for having two paths where they share no vertices or edges except possibly the endpoints (internal refers to everything strictly between the endpoints). From this point of view, disjoint would be incorrect since both paths share endpoints, i.e. they aren't disjoint. (It's also ambiguous as to whether it's referring to edge-disjoint vs vertex-disjoint.) Since I am coming from a more formal setting, if you think dropping "internal" would still be clear enough for competitive programmers, then sure that's fine. |
|
Wouldn't it be easier to change the code to use wiki's definition https://en.wikipedia.org/wiki/Biconnected_component ? Define biconnected components as maximal biconnected subgraphs, where a graph is considered biconnected iff it remains connected even if any one node is removed. |
Ah, right, I was thinking disjoint as in edge-disjoint but of course that's not what biconnectivity is about... No, on further thought this PR makes total sense; I'll merge.
I think the code is good as is, it's easy enough to change if you want the callback to be called for bridges too, and they are a bit of a special case that you often want to treat separately. |
ba85dcd
into
kth-competitive-programming:main
|
This is more of a nitpick. If you have just two nodes with an edge between them. Is the path between them internally disjoint with itself? I would argue that it is. It is also what you get googling the definition of internally disjoint. This is part of the reason why I think it is natural to just include bridges as biconnected components in the first place. |
It is not as they share an edge (internally disjoint refers to comparing both the vertices and edges with an allowance for the endpoints repeated; edges are always internal). It also isn't possible to form a cycle out of a single edge. More on internally disjoint can be found here:
|
Seems to me like wiki is the odd one out. All of the other top hits on google, and for example chatgpt, define internally disjoint as having no vertices in common except for the two end points. See: https://chatgpt.com/share/690d0042-da7c-8012-bc8d-ad5f314a8190 . |
As with most things in math, there are multiple definitions. One of the valid definitions does refer to sharing no internal vertices, but the devil is in the details. If you find a definition in a textbook (I wouldn't recommend an LLM since it doesn't give full context and can hallucinate), you would notice that it's referring to two paths from u to v (distinct is implicit since we wouldn't say that the graph Try asking the LLM you provided the very question you were actually trying to answer (whether a path can be internally disjoint with itself). |
FWIW when I ask ChatGPT whether a single edge path is internally disjoint from itself it says yes, referencing the definition that only looks at vertices. |
Interestingly, I previously asked the same question directly in the link you provided and it said the opposite. I hope this makes it clear why using LLMs for something like this isn't reliable. |
Two distinct paths is a very weak statement (as having overlapping paths which differ by just one edge/node are distinct). Internally disjoint is a much more apt description.