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

RSDominanceTreeLayout freezes (infinite recursion) with loop in diagram #1

Open
JanBliznicenko opened this issue Nov 25, 2023 · 1 comment

Comments

@JanBliznicenko
Copy link

JanBliznicenko commented Nov 25, 2023

If you have a loop in a diagram and try to use RSDominanceTreeLayout, it causes infinite loop. An example:

c := RSCanvas new.

b1 := RSBox new.
b2 := RSBox new.
b3 := RSBox new.
boxes := { b1. b2. b3 }.

a1 := RSLine new from: b1; to: b2; yourself.
a2 := RSLine new from: b2; to: b3; yourself.
a3 := RSLine new from: b3; to: b1; yourself.
edges := { a1. a2. a3 }.

c addAll: boxes; addAll: edges.

RSDominanceTreeLayout new 
on: boxes edges: edges.

Question is, whether dominance tree layout even makes sense for diagrams with loops. If not, maybe a detection and error might be nicer than Pharo freeze?

However, it worked with Roassal2.

@JanBliznicenko JanBliznicenko changed the title RSDominanceTreeLayout freezes (infinite loop) with loop in diagram RSDominanceTreeLayout freezes (infinite recursion) with loop in diagram Nov 30, 2023
@JanBliznicenko
Copy link
Author

Actually, similar thing happens in some cases, depending on sizes of the elements and subtrees, with regular tree layout as well (not just dominance):

c := RSCanvas new.

b0 := RSBox new.
b0 width: 200.
b1 := RSBox new.
b2 := RSBox new.
b3 := RSBox new.
boxes := { b0. b1. b2. b3 }.

a0 := RSLine new from: b0; to: b1; yourself.
a1 := RSLine new from: b1; to: b2; yourself.
a2 := RSLine new from: b2; to: b3; yourself.
a3 := RSLine new from: b3; to: b1; yourself.
edges := { a0. a1. a2. a3 }.

c addAll: boxes; addAll: edges.

RSTreeLayout new 
on: boxes edges: edges.

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

No branches or pull requests

1 participant