3 ms·
How do you traverse a symlink that points to one of its parent folders? How do you traverse a web of interlinked sites? Somehow Linux, Linux software, web brow
by lmilcin 5y ago
How do you traverse a symlink that points to one of its parent folders? How do you traverse a web of interlinked sites?
Somehow Linux, Linux software, web browsers etc. are already able to deal with directed graphs.
- MrLeap 5y agoYou can handwave cycles created by symlinks away by ignoring them. Full traversal is possible relying only on the tree. If all you have is the digraph you have to rely on cycle detection. Transforming it into a hierarchy of depth requires snipping edges somewhere. I'm just gently disputing the claim that a digraph can be mapped 1:1 to a hierarchical filesystem. I'm open to being wrong.
- lmilcin 5y agoNo, the intention is not to map it 1:1 to a hierarchical filesystem. My intention is to select a starting point, squint your eyes a little bit and then pretend it can be traversed from that point, the same you do when you search for a page on Wikipedia and then try to move around by clicking on links on pages. On Wikipedia you can choose any starting article and probably traverse entire Wikipedia. Your traversal tree will be different depending on what you select as starting point but the end result will be the same -- you will have traversed entire Wikipedia. When you see an article you already saw -- you just skip it for the purpose of traversal. Another way to imagine this: Windows Explorer Select your starting article as root. Then articles that are reachable directly from the root as first level nodes, then second level nodes are articles reachable from first level nodes, etc. This is infinite depth tree because any cycle will cause an infinitely long branch. But it is fine for a manual traversal (as a human you will notice you are repeating). And if you are traversing automatically there are easy ways to detect you have already seen the node (just detect the node you are visiting has id that has already been registered somewhere else in the tree -- maybe put all ids in a hash set?) --- I just figured out while trying to answer your question that the better description of what I would like to achieve would be "hyperlinked filesystem" except that hyperlinks also carry additional information about the link itself. In a filesystem there is only one type of link (parent/child folder/file relationship). In a hyperlinked filesystem you would have possibility of many types of relationships. On a normal filesystem Emacs could create a file with a tilde appended to its name to express it is backup of a file without tilde. On a hyperlinked filesystem Emacs could create an explicit link between the files with a suitable role. --- A filesystem like that would probably need multiple other ways to locate the files but it does not have to bee a tree-based structure. A tree-based structure would require the user to find a place for the file which misses the point of the filesystem (being free from having to find a location for the file). For example, additionally to graph based searches you should be able to search for properties including full text search on properties like names, descriptions, etc.