zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
26.85k stars 1.87k forks source link

Allow the option to make transclusion an additional note relation in the map (Feature request) #3840

Open 56independent opened 1 year ago

56independent commented 1 year ago

Describe feature

I have a note map which looks like some monster of lines and circles in the middle surrounded by a cloud of dots. When i open tree view, it's too rigid and monodirectional, not showing my disparate system of links.

I'd like to see a third button between "show links" and "show tree" when looking at the note map, showing:

Ideally, i would also like a slider to set which is prioritised when lowering the distance of the lines; the smallness of hierarchical links or the smallness of generic links?

Additional Information

No response

zadam commented 1 year ago

Do I get it right that what you want is to see both the tree hierarchy and the "normal" links in the note map?

I believe I did try this, but the mix of both tended to produce very confusing / complicated maps. Many lines / links crossing each other, no clear patterns being visible.

56independent commented 1 year ago

Yes, using a seperate button in between these:

image

I think that such a complicated map is a result of poor design; maybe lines could change thickness and length (keeping porpotion similar) based on how their type of link is biased, or maybe different colours could be used.

For example, i might have a 0.99 bias towards the tree and a 0.01 bias towards links. This way, we hava a similarity to the overall structure of a tree, but then thin weak grey lines could be connecting notes. This might make it look like a web, with the tree structure being clear.

But anyways, thanks for all your hard work on Trilium! It has changed my life towards a more productive and prosperous direction!

zadam commented 1 year ago

One problem with that is that IIRC the library which I'm using to render the maps ("force-graph") does not support per-connection "strength". They all "pull" the notes together with the same force.

56independent commented 1 year ago

Ahh, i see. This can be solved in one of two ways in my eyes:

Seeing as i am the suggestor of this idea, i feel fully willing to implement either of these changes given my large amount of free time (which i am managing to a level impressive of individuals with ADHD, mostly created by the well-selected freedoms (easy note creation and expansion through children) and limitations (such as a strict hierachy) of your software), given your green flag of implementation given quality of code.

zadam commented 1 year ago

Originally this note map feature was implemented using a more flexible approach / libraries, but the problem was with scalability - it started to choke at maps showing thousands of notes. Force-directed graphs are quite computation expensive, but this force-graph manages to behave well even with tens of thousands of objects. Not sure what the trick is, but maybe some of the optimizations require certain simplifications such as these.

I welcome any experimentation and would like to see more powerful visualizations. But before I see it, I can't give you a guarantee that your work would get merged.

56independent commented 1 year ago

I managed to get a response:

https://github.com/vasturiano/force-graph/issues/317#issuecomment-1512905424

Which includes these important details:

Let's look at line thickness first. This is a purely cosmetic item (does not influence the force engine), and you can manipulate it per link, using the .lineWidth method.

and:

As for the distance, or any other attributes of the link attraction force, you can calibrate it using all settings found in d3-force forceLink. The link force works a little bit like a spring in which each link has a target length (at rest), and any push/pulls from that position will be counter-acted with a linear attraction force. In this case if you're interested in changing the target distance of the links, you can do something like:

myGraph.d3Force('link').distance(link => /* your code */)

As such, i will now begin working on implementation and some prototypes of this potentially very helpful technology.

Edit Turns out that this is difficult to implement but with a little bit of function-reading by ChatGPT and suggestions, i can get halfway there.