SkepticMystic / graph-analysis

Analyse the structure of your Obsidian graph using various analysis techniques
GNU General Public License v3.0
400 stars 19 forks source link

Excluding specific files or folders #26

Closed kazdonkai closed 2 years ago

kazdonkai commented 2 years ago

I have created Index files with other plugin, but I want to exclude them from the analysis, so I want to exclude specific files or folders, is it possible?

SkepticMystic commented 2 years ago

That sounds doable! I can think of a couple edge cases, but basically we would just initialize the graph using a filter

kazdonkai commented 2 years ago

If possible, please allow us to use regular expressions to exclude files and folders.

SkepticMystic commented 2 years ago

@kazdonkai What sort of interface are you imagining? I could make a list of all files and folders in the vault, and you could pick which to include/exclude. I could allow a regex to include/exclude all files/folder that make. What do you think?

SkepticMystic commented 2 years ago

Btw, the effects would be global. So it would exclude those folders/notes for all analyses. (I'm just not going to add those notes to the graph, basically)

kazdonkai commented 2 years ago

I could make a list of all files and folders in the vault, and you could pick which to include/exclude.

Wouldn't this take too much time if we have a lot of files? I have 20,000 files in my Valt.

I could allow a regex to include/exclude all files/folder that make.

I think this is more practical. By the way, I put "_" at the beginning of the index files.

SkepticMystic commented 2 years ago

@kazdonkai check out 0.5.1. In the settings, you can now give a regex. Any file that matches this regex will be excluded from the graph.

I have tested it on my side. The regex matching works a little weirdly... but I was able to filter out specific notes. Please let me know your experience with this :) If you want to double check, after pressing Refresh (and enabling debug mode), open up the console, then look inside {g: MyGraph}. You'll see a list of nodes that were included in the graph.

image

kazdonkai commented 2 years ago

I put "^_. *" in the Exclusion Regex, but it seems not to work.

SkepticMystic commented 2 years ago

There mustn't be a space between . and *. Try ^_.*

SkepticMystic commented 2 years ago

Also remember that it's checking the whole file path. So if your index note is in a folder, you have to check for that too: folder/_.*, or [^/]+/_.* will both go one folder deep

kazdonkai commented 2 years ago

I entered "Task/^_.*", but it does not seem to be excluded. The index file is "Task/Recent.md".

スクリーンショット 2021-11-07 22 31 55
SkepticMystic commented 2 years ago

Try Task/_.*

kazdonkai commented 2 years ago

It worked well. BTW, what should I do if I want to set up more than one?

SkepticMystic commented 2 years ago

For now, only one regex is allowed. But I intend to add support for as many as you want! Please add a new FR for this, and I'll close this one out

kazdonkai commented 2 years ago

I am fine for now.Thank you.