Nearby Neighbors Plugin: POC release

A post was split to a new topic: Nearby Neighbours: A WikiText Solution

The backlinks donot work on tiddlywiki.com!

Yes, I didn’t know all of these when I went looking, but they are clearly related ideas. I had seen https://zettelkasten.sorenbjornstad.com/, which is wonderful, but far more than what I wanted for my usage. The same goes for your fantastic Node Explorer.

I told Tony I would think about this question a bit:

And I believe the following answers Tony and gives at least a partial answer to why my initial pass at this won’t likely show that information:

TiddlyWiki is used for all sorts of purposes. As an ultra-portable, easily editable, content storage and display system, its uses tend towards individuals or small groups who are both creators and consumers of that content. Its sheer adaptability makes it able to handle all sorts of complex requirements in a consistent manner.

But there is another style of usage, one where content creation and consumption are mostly separate. That’s where I’m focused right now. I’m working on a system where I’m the only – and soon to be one of only a few – people creating content. That content will be used by a few hundred others. Those others will likely know nothing at all of Tiddlywiki, and won’t even know its name unless they look at some fine print.

I’m using Tiddlywiki for this because of its microcontent focus, with the ability to reuse snippets across the pages, and to have various sorts of linkages between parts. I’m using it because I can make a simple link to the six specific pages this particular user really needs to read to solve a given problem. I’m using it because I can not only point to the URL, but also send the user an email with all the content packaged together. In short, I’m using it for many of the things that make TW great; but I’m not using it for any abilities of a user to add content. I’m not using it as a true wiki; that is reserved for just a few content-creators.

In this usage, I definitely do not want to show users that A is tagged B, that C transcludes D, that X links to Y. They should never care. But they might want to know that M is conceptually close to N. They might want to Q and R share some important connection. They would use this as an explorer, but a limited one. Here it would mostly be used for, “Well, I thought that page would answer the question I was asking, but it wasn’t quite it. What else is close by?”

While I and the other content creators could try to answer that with a related field or some such, that’s likely to be brittle and subject to all sorts of biases and oversights. It’s fairly rigid. The goal of Nearby is to gather that information organically from the structure of the wiki itself. It would be used to surf the documentation, following various trails through it marked by their own interest and not what I had in mind when creating it.

So the short answer to Tony’s question, is that this nearby algorithm will benefit wikis where the consumers will want to find their own ways through the content, not dependent on any particular schema or taxonomy the creators imposed. (This does not imply that it’s useless for personal wikis. The consumer and the creator could well be the same person.)

Yes, I’m hoping to create a graphical view, although likely not a tree. The list of links is a temporary placeholder. Although I’d seen Tidgraph a few years ago, I’d forgotten all about it. I will look to its implementation for inspiration.


Here’s where I see myself going with this:

  1. Figure out a storage mechanism for a set of distance measurements across the whole wiki, perhaps a JSON Tiddler whose keys look like "Tiddler 1|Tiddler 2" and whose values are numbers.

  2. Run Dijkstra’s algorithm or some other shortest path tool, using the distances I’m already creating as initial edge weights, to create a full set of distances. (Some may be infinite if this doesn’t connect the graph of tiddlers; I don’t think that’s a problem.)

  3. Figure out a layout mechanism to display these in a graph, using the distances as guidance, centering a specific node (the current tiddler). If I try something like a force-directed graph, then perhaps make this an animation on expansion of the Nearby section. I imagine this will only involve the few dozen closest nodes, and not the whole wiki, although that might be a fun bonus of this technique.

  4. Determine whether this is fast enough to run on a large wiki every time the user opens a tiddler or every time they expand a Nearby section. If it is (I’m doubtful), then proceed to the cleanup step.

  5. If that’s too slow, figure out how to run steps 2 and 3 only occasionally. For my own purposes, this could be only at startup; but it might be possible to schedule this to run periodically on a Web Worker.

  6. (Cleanup) Make this configurable in various ways. I’m thinking especially about the factors discussed in #5638 weighting the various kinds of connections and about the View provided to show the nearby neighbors.

I don’t know that I have the skills to do all of that, nor do I know if I’m willing to commit the time. But that’s how I would like to proceed. If I find myself unable to continue, I’ll probably at least do #6 to turn this from a POC to at least a beta level plugin.


Even discussing this here, I’m thinking about a potential alternative view, one that might appeal to those working on more personal notebook-style wikis: Lay out a graph of the whole wiki, and then, to show the neighborhood of one tiddler, pan and zoom that into focus. This might also include multiple edges between tiddlers with colors to indicate the type of connection. There’s a fair chance that this would be too busy, and that we’d have to find a way to remove or deemphasize edges for tiddlers not in the current view. This may be beyond my skills; I haven’t done much with graphics coding, but I could see this as a wonderful way to experience a complex wiki.

2 Likes

Is this directed to my version or to Yaisog’s alternative?

1 Like

That’s definitely in the plans. I want to expand the set of factors used, make the weights they’re assigned configurable, and allow the user to select only a subset of these factors. I can think of some others sorts of configuration as well. I was assuming that this configuration would be global, but I can imagine the ability to override the global config with a field on a particular tiddler. (That would not work well with my more grandiose ideas for displaying the whole neighborhood in a large pannable, zoomable graph; I don’t think that’s a problem.)

1 Like

The backlinks operator only detects hard links, but not links in transcluded content and such; see also https://tiddlywiki.com/#Hard%20and%20Soft%20Links
Could this be the reason for unexpected behavior?

Have a nice day
Yaisog

This is what it looks in my wiki with icons instead of text (showing in the SideBar, hence the muted colors):

image

Most of the relations are spouse (there are tiddlers which have both the current and the listed tiddlers as tags, and these are mostly journal tiddlers). Some siblings, children and links / backlinks are also shown.
I had to pixellate the text as this is my work wiki – my other wikis do not have so many related tiddlers.
The icons have tooltips to explain their meaning for when I forget. :wink:

Ah sorry! This is related to @Yaisog vrsion!

1 Like

I think the below line in your code is the source of issue:

<$set name="neighbors" filter="[enlist<fieldedTiddlers>] [enlist<taggedTiddlers>] [enlist<siblingTiddlers>] [enlist<spouseTiddlers>] [enlist<linkedTiddlers>] -[all[current]] -[filter<exclusions>]">

the [enlist<backlinkedTiddlers>] is missing.

Note this from Yaisog’s explanation above:

No, the reason is the missing filter run in neighbors, this run shall be added [enlist<backlinkedTiddlers>]

More comments:

I think it is good to have a terminology section to describe what is each node!

link
backling
tagged
tagging
sharedTagedTiddlers or spouce

There is an incomplete list of terms here: Shiraz 2.7.2 — create stylish contents in Tiddlywiki

but as the nearby neighbors has a litlle complex set of filters, to better understand it, I would suggest to add this terminology section

If you’re talking about the code in Yaisog’s first post to this thread, then I don’t see that backlinkedTiddlers is even defined. I thought the explanation I quoted was the reason. Yaisog believes these are too expensive to calculate for something like this. But maybe I missed the definition somewhere.

@Yaisog - would you care to put up a tiddlyhost to demo it? Thanx.

@Yaisog has attached his tuned solution later in post 21 → Nearby Neighbors Plugin: POC release - #21

1 Like

This thread is fascinating! Looks useful!

BUT it got very esoteric.

I hope the outcome gets published in an understandable form for mortals like me.

Just a comment
TT

Hi Mohammad,
you’re exactly right, the backlinkedTiddlers filter run was missing. I have updated the JSON-File in my Post #21 accordingly.

I’ll try to get around to define things a bit better. But where should I put that? Comments inside the tiddler? I would like this little project to not grow beyond a single, simple tiddler. I wouldn’t mind if someone turned this into a plug-in, with “real” configuration tiddlers and all. Unfortunately, I don’t think I have the time for that.

I don’t think it’s really worth the effort. You can just download the single, self-contained tiddler from Post #21 and drop / import it into tiddlywiki.com. It’ll be immediately functional and you’ll have your demo site.

Have a nice day
Yaisog

1 Like

I think this is fine! may be at the start or end of tiddler. I would recommend defining terms (as you did partially in post 21).

A dedicated thread for WikiText solution tagged with Tips and Trips would be beneficial.

1 Like

I’m not sure what Yaisog’s plans are, but I expect to continue to make changes as I have time and to post the results as new point releases to my plugin. I don’t want to call this anything even close to an alpha release yet, as I’m still trying to figure out if what I want to do is even remotely achievable for someone with my skills. But I’ll keep trying.