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

[Feat]: How can I make the G6 5x version routing similar to the one that the x6 has under the Manhattan type? #6688

Open
verron16 opened this issue Jan 2, 2025 · 3 comments
Labels
status: waiting for author Issue with insufficient information

Comments

@verron16
Copy link

verron16 commented Jan 2, 2025

Describe the feature / 功能描述

Example - https://x6.antv.vision/en/examples/edge/router#manhattan

The key: The connecting line bypasses obstacles in the form of nodes, skirting them from a convenient side

Are you willing to contribute? / 是否愿意参与贡献?

❌ No / 否

@verron16 verron16 added the status: waiting for maintainer These issues have not yet been reviewed by a maintainer label Jan 2, 2025
Copy link

To achieve a routing style in G6 similar to the Manhattan type in X6, you would need to implement a custom routing algorithm. The Manhattan routing style is characterized by lines that move horizontally and vertically, avoiding obstacles by skirting around them.

Here's a general approach to create a similar routing in G6:

  1. Custom Routing Algorithm: Implement a custom routing function that calculates the path by checking for obstacles (nodes) and adjusting the path to go around them. This involves:

    • Identifying the positions of nodes.
    • Calculating a path that moves in straight lines (horizontal and vertical).
    • Adjusting the path to avoid nodes by adding bends at appropriate points.
  2. Use of G6's Built-in Features: G6 provides some built-in edge types and routing strategies, but for a Manhattan style, you might need to extend or customize these.

  3. Pathfinding Libraries: Consider using pathfinding algorithms or libraries that can help calculate paths around obstacles. Libraries like A* or Dijkstra's algorithm can be adapted for grid-based pathfinding.

  4. Visualization and Testing: Once the routing logic is implemented, visualize the paths in G6 and test with different node configurations to ensure the routing behaves as expected.

If you need further assistance or specific code examples, feel free to ask!

🪧 Tips For further assistance, please describe your question in the comments and @petercat-assistant to start a conversation with me.

@verron16
Copy link
Author

verron16 commented Jan 2, 2025

And there is an example of implementation?

@yvonneyx
Copy link
Contributor

yvonneyx commented Jan 3, 2025

@yvonneyx yvonneyx added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues have not yet been reviewed by a maintainer labels Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants