4 ms·
> It’s basically a graph. do you mean it's a basically a tree? Because if it were just a graph, you could still have edges from the grandparent to the grandchi
by xdavidliu 2y ago
> It’s basically a graph.
do you mean it's a basically a tree? Because if it were just a graph, you could still have edges from the grandparent to the grandchild in addition to the one from the former to the child
- red_admiral 2y agoThis ... depends. In normal POSIX land, hard links break the tree structure, for one, so you get a DAG but not a tree. I think some file systems do enforce tree structure, though - hard links are not supported everywhere. It used to be possible ages ago to hard link to directories, which meant that you could have actual cycles and a recursive tree-walking algorithm would never terminated. (As far as I know you can still do this by editing the disk manually, although I think fsck will make a fuss if it detects this.) You can still, with the right syscalls and drivers, do something like hard links on NTFS (I think they're technically called mount points but it's not the same thing as POSIX ones). I'm not sure if you can still make directory cycles, and you're probably a bad person if you do.
- account42 2y agoLogically, ".." is a hard link to the parent directory. This may or may not actually be the case in the filesystem on the disk.
- monocasa 2y ago> , hard links break the tree structure, for one, so you get a DAG but not a tree. More than DAGs, but instead pretty arbitrary graphs since you can express cycles with hard links.
- Sebb767 2y ago> since you can express cycles with hard links You can't if you only allow hard links to files.
- nerdponx 2y agoA tree is a specific kind of graph.