Understand-Anything icon indicating copy to clipboard operation
Understand-Anything copied to clipboard

Nodes are gathered in straight horizontal line, not human read friendly

Open bsuvonov opened this issue 8 months ago • 9 comments

Hello, I love the project idea. I have wasted hours before to create a knowledge graph myself with obsidian to understand parts of kernel code. I have tried generating the graph with codex before too but I've always had the same issue as here:

Image Image

you can see that nodes in straight line and paths are overlapping, making it unreadable.

I am using Codex, and trying to generate a graph for https://github.com/gormanm/mmtests

bsuvonov avatar Mar 23 '26 08:03 bsuvonov

I see. Do you think if we make those not active parts folded would help?

Lum1104 avatar Mar 23 '26 08:03 Lum1104

Not sure, I didn't look carefully yet. But I honestly came here hoping someone did it for me, because as I said I could generate graph for obsidian canvas through codex too, and I used to get the same results.

There should be some algorithms to reach minimal number of path crosses (to reach minimum number of edge crosses in graph data structure). The lower the number of path crosses, the more readable the graph would be.

I will have a look later.

bsuvonov avatar Mar 23 '26 11:03 bsuvonov

Intesesting, I'll research on this. Thanks!

Lum1104 avatar Mar 23 '26 11:03 Lum1104

I tried the skill for the first time yesterday, on a huge codebase, and got the same hierarchical structure graph. For a large number of nodes it is probably less appropriate. After noting this to Claude it added two new graph display modes: force and radar, which are more useful and pleasing IMO. If you like I can probably add a PR with that change (I have to review it a bit first, didn't have time to do that yet).

Image

yanivby avatar Mar 23 '26 17:03 yanivby

Scattering nodes is better, but would be best if we could ensure that highest readability can be achieved. Maybe through hierarchical positioning.

bsuvonov avatar Mar 24 '26 00:03 bsuvonov

Here are some function call trees I have created before. I don't say they are optimal, but idea is hierarchical might be better for codebases from top to bottom or left to right since in code as well, functions don't call other functions in higher level than them due to layer programming.

Image Image Image

bsuvonov avatar Mar 24 '26 01:03 bsuvonov

Hi @yanivby and @bsuvonov, thanks to both of you for the feedback and the great discussion!

@yanivby, I completely agree that standard hierarchical graphs can get cluttered on huge codebases with a massive number of nodes. However, regarding the force and radar display modes, I've actually found that radar types can be quite hard for a human to read and follow. Before I implemented the Understand-Anything project, I tried using some GraphRAG approaches to index the codebase; they also relied on radar-style graphs, and I found it took a bit too much time to track the paths effectively. Still, I really appreciate you taking the time to suggest it and offering a PR!

@bsuvonov, your visual examples are incredibly helpful, and I actually prefer this approach. A top-to-bottom or left-to-right hierarchical structure makes a lot of sense for visualizing code. As you pointed out, it aligns perfectly with the nature of layered programming—since lower-level functions don't typically call higher-level ones, it makes the overall flow much easier to visually digest.

Thanks again to both of you for sharing your insights!

Lum1104 avatar Mar 24 '26 01:03 Lum1104

openclaw/understand-anything/understand-anything-plugin/skills where is the files ?

how to get start this project ? i want to use it

kaxipig avatar Mar 26 '26 06:03 kaxipig

@bsuvonov I was facing a similar issue, and after some brainstorming and tweaking managed to get a hierarchical render using dagre graphs itself. I realized we already have layers like "Service layer", "DB layer", "API layer" already created, so we can hierarchically organize the graph and make it clickable. It also shows connections across layers.

This is what it looks like (this is for a project with 200+ nodes):

Image

Short gif of what the flow looks like with hierarchical graphs.

Image

I essentially made it a two-layer navigation model - with breadcrumbs to tell you how much you navigated. I've also changed some of the UI elements in the sidebar. I have pushed changes in this PR if you folks wanna try it out. It works with existing graphs, too would love to hear your thoughts!

fishinakleinbottle avatar Mar 26 '26 21:03 fishinakleinbottle