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

Is it possible for IGGraphEditor to change the curvature of a straight edge by dragging and dropping? #127

Open
lichengzhang1 opened this issue Jan 23, 2023 · 1 comment
Assignees

Comments

@lichengzhang1
Copy link

Cross-posted at Mathematica stack.

<< IGraphM`
g = CompleteGraph[{2, 2, 2, 2}]
IGGraphEditor[g]

In IGGraphEditor, we can easily move vertices of the above graph $K_{2,2,2,2}$, but drawn edges are always straight lines and cannot be altered to be curved.
zzz

For example, I prefer the following layout of $K_{2,2,2,2}.$

image

I don't know what is difficult about that? Because many dynamic drawing systems, such as houseofgraphs and layout = interactive in maple also only provide the ability to draw straight lines.

@szhorvat
Copy link
Owner

szhorvat commented Jan 23, 2023

I'm happy to see that people enjoy using @kubaPod's graph editor!

My take on this is the following:

  • The primary intention of the graph editor is to be able to quickly create small graphs with the desired structure. Detailed visual customization is not a major goal. If that is needed, diagramming software, such as yEd, will be a better choice that we couldn't possibly compete with anyway.

  • Regarding changing the curvature of each edges individually, by dragging: This is problematic, and I do not think it should be implemented at the moment. The reason is that there is no clean way for users to alter the routing of edges in a Graph. Graph does support edge routing, as evidenced by the LayeredDigraphEmbedding graph layout, which routes edges to avoid collisions with vertices. The EdgeShapeFunction can also take not just two endpoints, but an entire list of points that define where the edge runs. But this appears to be an internal feature. I was unable to find a way to access it, even through undocumented means. We can set vertex coordinates, but there seems to be no way to set a list of routing coordinates for each edge. In fact, I've requested this feature already years ago, but it hasn't been implemented yet.

    The only way for a user to customize edge routing is to set a different EdgeShapeFunction for each and every edge. That is a very problematic thing to do as the edge routing won't be able to adapt when the graph is changed. I do not think we should go down that route.

  • A practical solution would be for the graph editor to respect the EdgeShapeFunction setting, and just set a curved edge shape. I.e., it would not be possible to shape each edge separately by interactive dragging, but it would be possible to make all edges appear curved. Something like this: CompleteGraph[{2, 2, 2, 2}, EdgeShapeFunction -> "CurvedEdge"]. I do not know if this is feasible for IGGraphEditor[] in practice. Performance might be a problem. It's up to @kubaPod to decide how to proceed here, as he understand much better what is possible and how much work this would take. My suggestion is not to sacrifice interactive editing performance for custom edge shapes.

@kubaPod kubaPod self-assigned this Jan 23, 2023
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