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

[DIAGRAM PROPOSAL] Tree Diagrams (Slim) #6015

Open
Connor-Bernard opened this issue Nov 1, 2024 · 0 comments
Open

[DIAGRAM PROPOSAL] Tree Diagrams (Slim) #6015

Connor-Bernard opened this issue Nov 1, 2024 · 0 comments
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram

Comments

@Connor-Bernard
Copy link

Connor-Bernard commented Nov 1, 2024

Proposal

Initially detailed here.

example of expected tree

Simple tree diagrams (specifically those for syllable and syntax trees). Namely, it would have the following features:

  • Create nodes with no border

  • Make nodes connect at the top and bottom

  • Custom connections like the split nucleus or the triangle connection (the below example)

    expected tree diagram with triangle connections

Currently, this is what I have found to be the analogous operations for Mermaid:

mermaid version

This is somewhat similar to #3989

Use Cases

This would be good for a whole host of different things. Namely, as per my and the OP of the linked stack overflow comment, it would be helpful for diagramming syntax parsing (parse trees) for NLP. Regardless, it would be helpful for any type of light-weight tree.

Screenshots

example of expected tree

expected tree diagram with triangle connections

Current best-effort diagram (with existing Mermaid synatx):

mermaid version

Syntax

Two options:

  1. Use the current flowchart diagram (this would likely be easiest as it should only require re-skinning it and adding a couple of new components).
  2. Add a more useful shorthand such as the following:
tree
    DP -- D, NP
    D -- the
    NP -- Adj, NP
    adj <| big
    NP -- Adj, N
    Adj <| red
    N -- hat

Important

Since tree structures are inherently non-recursive, we can use the last mentioned reference of a symbol when parsing a root. There will only be one root (no previous reference) and it is the first symbol of the syntax; all other symbols must be previously defined.

The above example syntax would render:

expected tree rendering from example

Implementation

This is a proposal which I'd love to see built into mermaid by the wonderful community.

@Connor-Bernard Connor-Bernard added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram labels Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request Type: New Diagram
Projects
None yet
Development

No branches or pull requests

1 participant