How do I retrieve all associated (double-chained) paths that exist between two arbitrary tiddlers by double-linking

They are associated by “[[]]”

could you perhaps tell us the exact outcome you want to see for the example you have provided

are you looking for some kind of filter that can give you a list of tiddlers linked together in a hierarchy? , Ancestors and descendants filter operators or
Release: Improved performance of Kin filter

otherwise i am bit confused as to what you want to achieve?

4 Likes

I am confident there are a number of ways to achieve what you are asking. I have explored building network databases, representing communications networks, and looking for the critical path, not to mention hierarchical lists and tree walking.

  • I also actively pursue methods to overcome any apparent issues with these kinds of issues in tiddlywiki.

If you could provide test data, a demo wiki or an example using existing data on tiddlywiki.com we could give you much better answers.

Try and explain your data and desired results, not the code you think will help.

1 Like

http://tiddlywiki.com/

So I can say that one of the paths from tiddlywiki to macros is shown in the above photos

I would look at how tiddlymap links the relationship with a no limit neighborrhood scope.

1 Like

I think we understand how your input works. But what are you looking for for output? Do you want a graph like what TiddlyMaps draws? Do you want something like what I earlier proposed for breadcrumbs?:

OnePath.json (983 Bytes)

Are you simply looking to collect the data, and if so, what’s the output format? I wrote a JS implementation to collect this information as an array of arrays of tiddler names, but that format isn’t so useful in TW. (It’s also based on tags, not links, but that’s an easy switch.) And it collected all paths from certain root nodes

One other concern: any realistic techniques to do this through links are going to have to deal with the fact that only hard links are readily available to work with.

1 Like

Thank you very much for providing the functional code,I want to see the possible knowledge correlation between different items, so that when I learn new knowledge at the midpoint between two or more notes I have recorded, it is easier for me to quickly organize the network of notes, and quickly approach the new knowledge to be learned from all directions, so that learning a new knowledge has structure and logic

You still haven’t demonstrated the output format you’re looking for.

How do I retrieve all associated (double-chained) paths that exist between two arbitrary tiddlers by double-linking

I assume you don’t want a pointer to the entire wiki, which already includes all that information. So what sort of output do you actually want?

It looks something like this, except where the abc corresponds, is all the possible ways that the knowledge path I’m going to traverse from start to finish

The format is likely to be real-time, just like looking up Google, probably not many people will export their website search history to the local bar

I’m sorry, I still make no sense out of this. Do you want to somehow highlight tiddlers (do you have to open them first?) if they happen to fall on one path between, say, HelloThere and Macro Calls in WikiText? What if there are three paths? Or thirty?

Returns every link path that can lead to each other, all of them, such as two tiddlers with an average distance of 100 links between them, and 100 connecting paths between them

Such as:

“a->b->c”;
“a->c”;
… ;
… ;
… ;

Then the code I shared above is a very good start. It would have to be updated for links versus tabs, and both inputs would be the full list of all (non-system?) tiddlers.

We can do this for a small list (update: fixed this link!) very easily. But that list has 11 entries with an average number of links of 1.18. That yields 44 paths. If we were to try this on tiddlywiki.com with its 1621 non-system/non-shadow tiddlers with an average number of links of 2.12, I’m guessing it would yield, at a minimum, tens of millions of paths.

If you wanted to select a start tiddler, an end tiddler, or both, this seems feasible. But listing all paths for any medium to large wiki seems unlikely. And it would get tremendously worse if we tried to deal with soft links as well.

2 Likes

A good example already built into tiddlywiki is the Table of Contents, see tiddlywiki.com. This starts are the tiddler TableOfContents and follows all tiddlers that use the current tiddler as a tag.

  • This is a hierarchical structure based on tags.

If you are going to automate this as in the chain of links you followed from HelloThere > TiddlyWiki > WikiText > Markdown > Macros are only a very small subset of links and paths available.

  • Note these links may or may not be in the table of contents, they come from the content of each tiddler you visit.

What I think you want is an equivalent to the TOC based on tags, but for links displayed in each tiddler?

  • Is this correct ?

For example;

Hello there

TiddlyWiki

WikiText

1 Like

Nice, this is one step closer to the ultimate goal, it can list all the double-linked links under the current note, maybe it is not practical to traverse all the paths of the knowledge base in pure wiki syntax, but we can export an index list of the outbound links of each tiddlers, and maybe use python to do a deep walkthrough

I created a tiddler that uses the current wiki to generate JS code you can paste into a JS environment (Node.js, the browser console, some online REPL [such as the one I use], or wherever.)

Download this link: Build List.json (1.3 KB), import it into your wiki, copy the JS code it renders, and run it in some JS environment. Note that almost certainly the number of tiddlers on tiddlywiki.com, especially with the number of links per tiddler, will almost certainly be too large to run in any reasonable amount of time.

For example, I chose, mostly randomly, the wiki https://maths.tiddlyhost.com/, which has 148 regular tiddlers with around 0.37 links each. I dragged that tiddler onto the wiki, imported it, copied the resulting code onto a REPL, and in the output received 464 paths:

"Bit-square theorem → Nonstandard Analysis";
"Bit-square theorem → Nonstandard Analysis → First fundamental theorem";
"Bit-square theorem → Nonstandard Analysis → Fundamental theorem of set theory";
"Bit-square theorem → Nonstandard Analysis → Linear Programming";
"Bit-square theorem → Nonstandard Analysis → Linear Programming → Set Theory";
"Bit-square theorem → Nonstandard Analysis → Linear Programming → Topology";
"Bit-square theorem → Nonstandard Analysis → Linear Programming → Topology → Set Theory";

...

"Theoretical Informatics → Set Theory → Nonstandard Analysis → Topology";
"Topology → Set Theory";
"Topology → Set Theory → Nonstandard Analysis";
"Topology → Set Theory → Nonstandard Analysis → First fundamental theorem";
"Topology → Set Theory → Nonstandard Analysis → Fundamental theorem of set theory";
"Topology → Set Theory → Nonstandard Analysis → Linear Programming";
"Topology → Set Theory → Nonstandard Analysis → Number Theory";
"Topology → Set Theory → Nonstandard Analysis → Second fundamental theorem";

(Note that I added spaces around the arrows, because it looks better to me. You can remove them in the last line of that tiddler’s source code.)

If this looks useful, we can investigate how to turn it into a widget/macro/procedure you can use to show these directly on your wiki.

1 Like

The code is cracking. It’s great!Here I drag and drop this code to a Chinese tiddlywiki forum, and it looks like this, the code works fine, but there is no “->” thing

That result is just JavaScript source code. You would have to run it in a JavaScript engine. See the directions in my last post.

This is not an overall solution to your request, only a step along the way. If it does what you would like, we could look into turning it into some sort of TiddlyWiki module.

There are three concerns:

  • Is the output—after you run that JS module—what you’re looking for?

  • Do you need more control over the input? Right now it finds all paths between any two tiddlers, ignoring loops. But we might want to find only those paths starting from a particular tiddler, all those ending at a particular tiddler, or both. We might also want to include only a subset of the tiddlers by supplying it a filter.

  • There is a terrible inefficiency in the code. We can probably fix that without too much difficulty, but it’s not clear if that is worth doing. As mentioned above, a relatively small wiki with little interconnectivity ended up with 464 paths. I didn’t think this would usefully scale up to something like tiddlywiki.com, with 1600+ tiddlers and many more links per tiddler. So I think you would need to investigate whether it is going to be useful for the size wiki you want to work with.

1 Like

This is what I need

I want to handle it in python

The expression is similar to that of the knowledge graph in obsidian in the double link path search plug-in

If all you want is the raw data that you can use in Python, this will generate it in JSON format:

\define links() <$text text={{{ [{!!title}links[]!is[system]] :map[search-replace:string["],[\"]addprefix["]addsuffix["]] +[join[, ]] }}}/>
\define row() {"title": "<$text text={{{ [{!!title}search-replace:string["],[\"]] }}}/>", "links": [<<links>>]}
<pre><code>[
  <$list filter="[all[tiddlers]!is[system]] -[[Build List]]" counter="counter"><<row>><$text text={{{ [<counter-last>match[yes]then[]else[,
  ]] }}} /></$list>
]</code></pre>

List Links.json (626 Bytes)

(Yes, I know that I could replace the counter-last stuff with join in the <$list...>, but I was testing this against some 5.3.1 wikis.)

Let us know how it goes!

1 Like

I just want to point out there are a range of methods to “walk” hierarchies and networks including the table of contents, the TOCP plugin, The Kin operator and the recent taggingtree and tagstree operators.

Although you can build anything similar using a recursive macro or procedure call without javascript. Search here for “recursion”

1 Like