Directory folder tree in graph-view

Use case or problem

I organize relationships between files with folders.
Here’s an example directory I may have in my vault:

  • Countries/
    • Canada/
      • note1.md
    • US/
      • note2.md

When I want to visualize the connections between files with graph view, all my files are spread apart with no connections. I would like to see a tree-like structure with a Country node linked to 2 child nodes, each having a node of their own. Then those nodes might be connected if there’s a reference between the two.

Proposed solution

Add an option to show the folder tree (where folders are also nodes) in the graph view, along with the connections between files.

Current workaround (optional)

I have a “index” file in every folder, which links to index files in any child folders, and any files in its folder.
That index file is the folder’s placeholder in the graph view.

1 Like

I agree with this being something I’d really like. One of the significant difficulties in graph view is that closely related things are so far apart. However I think the links in directories are different and weaker than direct relational links so instead of the earlier proposed solution I have another:
First lets think of any file or directory at a given directory level as a generic node, with directory nodes being made up of the average location of their contained files or directory nodes. For empty directories they can be removed from consideration.

  1. First within a directory have all nodes pull toward the average center point of a their given directory (For sub-directories this pull is twofold in that there is one for that subdirectory but the parent node pulls all subdirectory children as well)
  2. Using D3.js, generate optionally organic (which will leave negative space) or normal Voronoi diagram from the nodes, weighted by number of files or some other mechanism to reasonably encase all files in a directory and subdirectory.
  3. From the generated partitions of the previous Voronoi diagram you can sequentially do the same thing and generate a Voronoi diagram within a Voronoi diagram’s unit, once again partitioning each node (both files and directories at the same level) by number of files within it.

This likely wont perfectly encase all the nodes and relate them to there directory, but something is better than nothing and I think this is a pretty reasonable to implement first attempt that would satisfy all most people concerned about this feature. Additionally if possible allow us to automatically color by rings based on path to directories all file nodes so that we can see how deep it is in the file tree by number of rings, which directory it is in by the color, and this would also remove most color conflicts (some will inevitably happen but once again something is better than nothing).

If none of that is easy enough or worthwhile enough to add, could anyone inform me the basics of how to mod the graph view as I have no idea where to start but I am more than happy to implement these?