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

Edge crossings with a simple graph #271

Open
usrlocl opened this issue Jan 24, 2025 · 3 comments
Open

Edge crossings with a simple graph #271

usrlocl opened this issue Jan 24, 2025 · 3 comments

Comments

@usrlocl
Copy link

usrlocl commented Jan 24, 2025

I modified the Direction example in the layout story to add another connected node. But the layout is getting generated with an edge crossing as shown in the image below.

    <Canvas
      nodes={[
        {
          id: '1',
          text: '1'
        },
        {
          id: '2',
          text: '2'
        },
        {
          id: '3',
          text: '3'
        },
      ]}
      edges={[
        {
          id: '1-2',
          from: '1',
          to: '2',
          text: '1-2'
        },
        {
          id: '2-3',
          from: '2',
          to: '3',
          text: '2-3'
        },
        {
          id: '1-3',
          from: '1',
          to: '3',
          text: '1-3'
        },
      ]}

Image

The same graph using D2 with Elk gives a clean diagram without any crossings here.

I'm wondering if there's some elk configuration that can achieve this, but the settings are quite overwhelming. It would be good if reaflow can have some sane defaults to achieve reasonably clean diagrams out of the box.

@amcdnl
Copy link
Member

amcdnl commented Jan 27, 2025

I know there is a setting for this in ELK but I can't remember it. Try searching the issues here, I think it has been mentioned before.

@usrlocl
Copy link
Author

usrlocl commented Jan 28, 2025

I went through the issues but couldn't find anything. FWIW, these are the settings I tried with various combinations to no avail.

        'org.eclipse.elk.algorithm': 'org.eclipse.elk.layered',
        'org.eclipse.elk.edgeRouting': 'ORTHOGONAL',
        'org.eclipse.elk.portConstraints': 'FREE',
        'org.eclipse.elk.layered.nodePlacement.strategy': 'LINEAR_SEGMENTS',
        'org.eclipse.elk.layered.crossingMinimization.forceNodeModelOrder': 'true',
        'org.eclipse.elk.layered.nodePlacement.networkSimplex.nodeFlexibility': 'PORT_POSITION',

@CTX-Rachel
Copy link

Is there a solution for this?
I am facing the same problem now, and I have more Nodes and Edges, so the situation is more serious.

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

3 participants