Giter Club home page Giter Club logo

Comments (2)

LLyaudet avatar LLyaudet commented on May 13, 2024

If someone ever fancy to draw flow-charts on higher genus surfaces it would also help greatly. "Mermaid.js in 3D with torus/doughnut now live!" :)

from mermaid.

LLyaudet avatar LLyaudet commented on May 13, 2024

Hello :)
No answer yet. I was wondering what is the algorithm used for planar drawing actually in mermaid.js.
As you can see my example does not have a K_5 or K_{3,3} minor.
But the drawing fails even on loops which no serious mathematician would consider in the beginning XD.
Maybe you could try just a simple planar graph embedding algorithm first before.
I found this recent article : https://arxiv.org/abs/1610.00130
But you would have to add a step of post-processing to fix the actual distances and positions.
If the problem on my example comes from the size of the labels, it could be solved by enlarging all the graph without enlarging the text and/or by shifting a little some text above another one (shifting is not required but would probably be more space efficient than enlarging everything.
I have looked at this also :
https://en.wikipedia.org/wiki/Force-directed_graph_drawing
But I know better the theory of graphs than the drawing of graphs.
I think it could handle the big labels in the middle of the arcs by splitting each arc in 2 and making its label a temporary vertex with a bounding box. And then a postprocessing step could redraw both parts of the original arc to make it a single curve with control points that fix its origin and source and the fact that it passes at the center of the label or at one extremity if you prefer.
It could be a choice given in the flow chart definition like :

  • A -X||->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
  • A -|X|->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
  • A -||X->|AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4| B,
    To put the crossing point where you want and fine tune your graph drawing.
    The suggested solution I gave first about Untangling planar curves could be used on top to draw non-planar graphs or if the main algorithm does not give a correct planar embedding when possible, as a "try harder" directive on named or enumerated arcs like untangle A --> B:1, A --> C:2 would try to untangle the first arc from A to B and the second arc from A to C in the flowchart definition.

from mermaid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.