"Adjacency Matrix Exporter" plugin

This is the link to the repository:

Through this plugin I created some interesting functions that can be useful to those who want to increase the mathematical functions within Obsidian and delve deeper into coding!

I would be really happy to meet programmers who want to develop such features within Obsidian!

The work I did is part of my thesis in industrial plant engineering at the UNINETTUNO university with which I obtained the title of management engineer.

I’ve updated the title of your post, it was way too long, and sounded like a demand

Thanks Johannes for your suggestion, I’m still not able to interact properly with the community… your support is really important!

I would like to make people interested in Typescript programming aware of the fact that there are some parts of code in the plugin that might be interesting:

  1. I programmed a function that counts the words inside a note and returns their value;
  2. I have programmed a user interaction box that manages the input and uses the data entered;
    For me it was a journey of growth in writing code starting from small things like interacting with the Obsidian console up to more sophisticated things.

The work I have done is extremely modular and I think it can be useful for those who are curious to increase the functionality of their codes through a more in-depth knowledge of Typescript…

Hello community developers! Given the work done and the interest it could arouse in a certain segment of the public, I decided to delve into the development process of the plugin and the various features present within a few days. This journey made in discovering the Typescript programming code and the Obsidian API is worth telling! I hope that what I share reaches as many users as possible. Help me spread the word! A thousand thanks! :wave: :wave: :wave:

POST 1 of 7: description of my journey :airplane:

My supervisor Prof. Andrea Falegnami of the international telematic university UNINETTUNO of Rome (Italy) proposed that I work on an experimental thesis in his subject Industrial Plants where the objective was the analysis, from a Project Management point of view, of an innovative product with two patents, one Italian and one European. We agreed to delve deeper into a very important tool for approaching complex systems, namely the DSM (Design Structure Matrix), the theory of which is carried forward by researchers from the best universities in the world. we had available calculation tools developed by MIT in Boston https://dsmweb.org/ and by the University of Cambridge https://camtoolkit.eng.cam.ac.uk/ and to add a new tool created within the Obsidian.md software: the creation of a numerical adjacency matrix of the notes present in the Vault.
The Obsidian software, as it is built, is perfect for implementing the mathematical theory of graphs and consequently matrix theory.
Initially the professor gave me this challenge: try to build a binary numerical adjacency matrix that would return the values ​​0 or 1 where 0 would indicate the non-existence of the connection between two notes and 1 the existence of this connection.
The professor also showed me a plugin to use as a study basis both to understand the structure of the Typescript code and to draw useful ideas for solving the proposed problem.
The plugin reported to me was SkepticMystic’s “Adjacency Matrix Maker” GitHub - SkepticMystic/adjacency-matrix-maker: Creative an interactive adjacency matrix of your Obsidian vault, a truly remarkable work which points out to anyone interested in learning more about this topic.
I have presented you the initial ingredients of this journey that began around the end of July 2023.

POST 2 of 7: description of my journey :airplane: :airplane:

The first result I achieved was to program the binary matrix of links between notes and bring it back to the screen through the Obsidian console: it can be recalled using the CTRL+SHIFT+I key combination.
In this phase I reviewed the fundamental constructs for writing Typescript code and explored the basic structure of Obsidian, discovering small but important things that made me take steps forward.
The goal was to pass the data from the console to an exportable CSV file for subsequent calculation processes. This step, after numerous tests and trials, also went well.
So I found myself expanding the functionality of the SkepticMystic code by adding a button that allowed you to save a CSV file to the Vault with the binary adjacency matrix of the links between the notes inside.

POST 3 of 7: description of my journey :airplane: :airplane: :airplane:

Subsequently came the new stimulus from Prof. Falegnami who asked me to move from a binary matrix to a numerical matrix that would calculate the multiplicity of connections between the notes: if from a note i we went to a note j via 4 links then in the adjacency matrix should have appeared 4 instead of 1. The calculation of the weights of the connections between the notes was the challenge that made me take a further step forward and which took me quite a long time. At the end of this process I was able to export the numerical adjacency matrix of link weights between notes to CSV. We did some stress tests to verify the effectiveness of the algorithm and everything confirmed that the problem had been solved!

POST 4 of 7: description of my journey :airplane: :airplane: :airplane: :airplane:

Another stimulus from Prof. Falegnami was the following: exporting a CSV file requires the use of a separator and sometimes it could be useful to change this separator depending on the case and the various contexts. The request was to program a new button that allows the user to choose the CSV separator before exporting the adjacency matrix file. Dealing with this new problem complicated things a lot because I had to approach programming the code from another point of view. The process of interacting with the data entered by the user opened up a series of new possibilities because I couldn’t have a base to start from in the SkepticMystic code. The effort made has been explored this part through other codes and other sources. After a few weeks of work, however, the plugin was enriched with a second button that allowed the user to choose the CSV separator.

1 Like

POST 5 of 7: description of my journey :airplane: :airplane: :airplane: :airplane: :airplane:

The next request from the professor was to program a new adjacency matrix: a normalized adjacency matrix where the weight of links between notes had to be divided by the total word count within the starting note. This problem also made me take a further step forward because I had to explore another point of view, namely the count of words within a note. Before receiving this request I had contacted SkepticMystic asking him to expand his code with mine and thus complete the programming work that seemed to be completed. After the professor’s request arrived which led to three buttons with their respective functions, the work to be done made sense to try to extrapolate the code written from that of SkepticMystic and create an entire plugin independently.

POST 6 of 7: description of my journey :airplane: :airplane: :airplane: :airplane: :airplane: :airplane:

It was time to take the final but most difficult step: isolate all the written functions, classes and objects making them autonomous from the guest code and compose an independent plugin. It wasn’t easy, I would actually say it was the most difficult step ever. The result was ultimately positive and for those who want to explore the code I wrote, they will realize that all these functions can be easily exported and increased with further features: in fact, I managed to make the code quite modular.

At the end of this path:

the user interaction box is made up of two buttons that export the adjacency matrices in the two Absolute and Normalized versions and there is a clickable link that allows you to change the CSV separator by opening a second window user interaction.

By keeping the Obsidian console open you can follow the results of the operations you perform via the console.logs that I have left active (to check that what you are doing is correctly executed).

POST 7 of 7: :checkered_flag: :checkered_flag: :checkered_flag: :checkered_flag: :checkered_flag: :checkered_flag: :checkered_flag:

Thanks:

  • I thank Prof. Andrea Falegnami (Tenured Researcher at the International Telematic University UNINETTUNO) who decisively brought me to the point where I have arrived!

  • I thank Ross Keenan who was my source of inspiration and who offered me his contact and his willingness to collaborate!

  • I thank the entire Obsidian Community which is a gold mine of ideas and information exchange!

  • I thank the reviewers who are closely following the plugin validation process and who I hope will be able to conclude it before my thesis: I will be able to proudly declare that my plugin is part of the Obidian community!

  • I thank the founders of Obsidian Shida Li and Erica Xu who have made a truly powerful tool available to future generations!

  • I thank everyone who had the patience to read these posts and share the journey made with me!

Today, December 6, 2023, the “Adjacency Matrix Exporter” plugin became part of the Obsidian Community. I want to share with all of you the joy of having given my small contribution to this special reality made up of many programming enthusiasts like me. Thanks to everyone who made it possible to reach this goal! :star_struck: :star_struck: :star_struck:

SPECIAL THANKS:

I would like to give special thanks to Johannes Theiner and Liam Cain, the two reviewers who with patience and dedication allowed the plugin to be corrected and entered into the community. Thank you guys for your work, your dedication, your passion! :+1: :+1: :+1: :heart: