newcat / baklavajs

Graph / node editor in the browser using VueJS
http://baklava.tech
MIT License
1.6k stars 117 forks source link

How to get the number of computational processes (or named functions, algorithms) in a graph #400

Closed chuteany closed 8 months ago

chuteany commented 8 months ago

How to get the number of computational processes (or named functions, algorithms) in a graph—for example, the graph below contains two, the number is two. And how to get some one of them

image

newcat commented 8 months ago

Baklava doesn't calculate this, since it is only concerned about the order in which nodes have to be executed. But you can use a simple BFS or DFS algorithm to compute the number of isolated parts in the graph. Have a look at this SO question, for example: https://stackoverflow.com/questions/1348783/finding-all-disconnected-subgraphs-in-a-graph

chuteany commented 7 months ago

thank you!