elk icon indicating copy to clipboard operation
elk copied to clipboard

force.repulsivePower does not produce bendPoints

Open timothypratley opened this issue 3 years ago • 5 comments

Expected: Supplying a force.repulsivePower in layoutOptions for an edge should result in bendPoints for the edge.

Actual: No bendPoints are produced.

The documentation for repulsivePower indicates that bendPoints should be created, but they are not.

Example 1: Basic force graph JSON definition

{
  id: "root",
  layoutOptions: {
    'algorithm': 'force'
  },
  children: [
    { id: "n1", width: 30, height: 30},
    { id: "n2", width: 30, height: 30},
    { id: "n3", width: 30, height: 30}
  ],
  edges: [
    { id: "e1", sources: [ "n1" ], targets: [ "n2" ], layoutOptions: {'org.eclipse.elk.force.repulsivePower': 4}},
    { id: "e2", sources: [ "n1" ], targets: [ "n3" ], layoutOptions: {'org.eclipse.elk.force.repulsivePower': 2}},
  ]
}

The resulting layout contains no bendPoints.

ELK Demonstrator

I observed this behavior in my JavaScript project (via ELKJS). The output layout has no bendPoints.

The nodes are placed further apart.

I have not tested this directly in Java native.

timothypratley avatar Mar 15 '22 23:03 timothypratley

I somehow got a mail that you closed this and found a way to specify it correctly. Can I close the ticket or does it still not work as intended?

soerendomroes avatar Mar 21 '22 08:03 soerendomroes

Hi @soerendomroes :wave:

Thank you for following up. When I first wrote the issue I placed the force.repulsivePower in the root layout options (incorrect). When I discovered my mistake (force.repulsivePower belongs on the edge), I closed the ticket to update the example then reopened it with the corrected input.

I believe the edited example above demonstrates the behavior described, that this is unexpected, and an open issue.

Please let me know if there is anything I can do to clarify or investigate further. I'm not sure that the ELK Demonstrator is the best way to report this kind of thing as it does not show the actual output of the layout in text form, is there a better way?

Sincerely, Timothy

timothypratley avatar Mar 21 '22 17:03 timothypratley

Thank you Timothy. If you can create it in the ELK Demonstrator it is fine. I prefer the elkt format over the json format but both work and you can convert between the two if necessary.

It is always nice to see a sketch of how you think the drawing should look like, especially if you have an issue with a layout algorithm that is not the layered algorithm. In your case, I guess you expect that the longer of the two edges has a bend in it since the created bendpoints should repel each other.

soerendomroes avatar Mar 22 '22 07:03 soerendomroes

:+1:

Example 1: Two nodes, 2 edges with repulsivePower on edges elkt demonstrator

graph root
algorithm: force
node n1 {
	layout [ size: 30, 30 ]
}
node n2 {
	layout [ size: 30, 30 ]
}
edge e1: n1 -> n2 {
	repulsivePower: 4
}
edge e2: n2 -> n1 {
	repulsivePower: 4
}

Produces:

repulsive

There are no bend points.

Expected (my annotations in red):

repulsive-edges

There should be bend points, and "such bend points are regarded as repelling particles in the force model" indicates that they edges would be pushed apart.

Example 2: using ports elkt demonstrator

graph root
algorithm: force
node n1 {
	layout [ size: 30, 30 ]
    portConstraints: FIXED_SIDE
    port p1e {^port.side: EAST}
    port p1w {^port.side: WEST}
}
node n2 {
	layout [ size: 30, 30 ]
    portConstraints: FIXED_SIDE
    port p2e {^port.side: EAST}
    port p2w {^port.side: WEST}
}
edge e1: n1.p1e -> n2.p2e {
	repulsivePower: 4
}
edge e2: n2.p2w -> n1.p1w {
	repulsivePower: 4
}

repulsive-ports

This just seems... odd! :)

timothypratley avatar Mar 22 '22 19:03 timothypratley

Related; setting the model to EADES pushes the nodes a very very long distance apart with repulsivePower at 1 or more :man_shrugging:

timothypratley avatar Mar 23 '22 07:03 timothypratley