Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto Node Layout fails for cyclic graphs #393

Open
xraybrian opened this issue Oct 25, 2023 · 4 comments
Open

Auto Node Layout fails for cyclic graphs #393

xraybrian opened this issue Oct 25, 2023 · 4 comments

Comments

@xraybrian
Copy link

I have implemented a data analysis framework that allows node computation and back propagation of derivatives for optimization of parameters by subclassing NodeGraph and BaseNode. This required allowing cyclic graphs so that the optimizer node can connect back to optimizable parameter nodes. Functionally, everything is working very well.

However, the auto node layout method produces a recursion error for a cyclic graph.

Any chance of supporting auto node layout for cyclic graphs?

@J-Arnold
Copy link

J-Arnold commented Apr 3, 2024

I have the same issue I like to virtualize a kind of workflow program, there I need to create loops but this is not possible at the moment.
Screenshot 2024-04-03 205255

@J-Arnold
Copy link

J-Arnold commented Apr 7, 2024

Hi,
I tested out some ways to create a loop my development.
To test you add the following lines to the basic_example.py

    n_basic_b1 = graph.create_node('nodes.basic.BasicNodeB', name='custom icon')
    n_basic_b2 = graph.create_node('nodes.basic.BasicNodeB', name='custom icon')
    n_basic_b3 = graph.create_node('nodes.basic.BasicNodeB', name='custom icon')
    n_basic_b4 = graph.create_node('nodes.basic.BasicNodeB', name='custom icon')

    n_basic_b1.set_output(0, n_basic_b2.input(2))
    n_basic_b2.set_output(0, n_basic_b3.input(2))
    n_basic_b3.set_output(0, n_basic_b1.input(2))
Loop_OK

If you try to connect another output to one of the loop inputs the Editor crashes.

Loop_Fail

Also the Program crashes if you add the connection by development adding the line:

n_basic_b4.set_output(0, n_basic_b1.input(0))

In some of my tests I got the following Error output:

Windows fatal exception: stack overflow
Main thread:
Current thread 0x0000913c (most recent call first):
  ....\Python310\lib\site-packages\NodeGraphQt\base\port.py", line 101 in name
  ....\Python310\lib\site-packages\NodeGraphQt\nodes\base_node.py", line 620 in <dictcomp>
  ....\Python310\lib\site-packages\NodeGraphQt\nodes\base_node.py", line 620 in inputs
  ....\Python310\lib\site-packages\NodeGraphQt\base\port.py", line 210 in connected_ports
  ....\Python310\lib\site-packages\NodeGraphQt\nodes\base_node.py", line 716 in connected_output_nodes
  ....\Python310\lib\site-packages\NodeGraphQt\base\graph.py", line 2149 in _update_node_rank
  ....\Python310\lib\site-packages\NodeGraphQt\base\graph.py", line 2163 in _update_node_rank
  ....\Python310\lib\site-packages\NodeGraphQt\base\graph.py", line 2163 in _update_node_rank
  ....\Python310\lib\site-packages\NodeGraphQt\base\graph.py", line 2163 in _update_node_rank
  ( this last line is repeated a lot of times )
  ...
Restarting kernel...

Another issue is that the Auto layouter is not able to create a layout all notes are stacking over each other.

Stacking

@jchanvfx
Copy link
Owner

jchanvfx commented Apr 9, 2024

Hi @J-Arnold,

Thanks for providing the examples and test 😃 this is really helpful, I'll try to look into this issue when I can.

Cheers,
Johnny

@J-Arnold
Copy link

Hi,
I tried the newest NodeGraphQt Version 0.6.36 but unfortunately it did not fixed my issue the programm is still crashing.

Did you got time to look into this issue ?

Thanks
Jens

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants