-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
🚀 feat: Added support for ipsep-cola layout algorithm #6639
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
base: develop
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: f06f1ba The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
…nitial positions for ipsepcola layout
## 📦 Prerequisites | ||
|
||
Before starting, ensure the following: | ||
|
||
- You have [Node.js](https://nodejs.org/) installed. | ||
- You have [pnpm](https://pnpm.io/) installed globally: | ||
```bash | ||
npm install -g pnpm | ||
``` | ||
|
||
--- | ||
|
||
## 🔄 Step-by-Step Integration | ||
|
||
### 1. Clone the Mermaid Repository | ||
|
||
```bash | ||
git clone https://github.com/mermaid-js/mermaid.git | ||
cd mermaid | ||
``` | ||
|
||
### 2. Install Dependencies | ||
|
||
Mermaid uses `pnpm` for dependency management: | ||
|
||
```bash | ||
pnpm i | ||
``` | ||
|
||
### 3. Start the Development Server | ||
|
||
This will spin up a local dev environment with hot reload: | ||
|
||
```bash | ||
pnpm dev | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid duplicating the dev setup as it makes maintaining harder, better to link to our existing setup docs, and update it if required.
We even have a feature where we can inject markdown files if required.
|
||
## 🔍 Comparison Table | ||
|
||
| Feature | Dagre | ELK | IPSep-CoLa (Upcoming) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will IPSep-CoLa
be upcoming after this is merged?
``` | ||
--- | ||
config: | ||
layout: ipsepCola |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General question, should we support an alias that's easier to remember?
} | ||
} | ||
|
||
data4Layout.edges.forEach((edge) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Better to stick with for..of
loop for consistency.
data4Layout.edges.forEach((edge) => { | ||
insertEdge( | ||
groups.edgePaths, | ||
{ ...edge }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to spread the edge here, rather than inside the function?
isEdgeLabel?: boolean; | ||
edgeStart?: string; | ||
edgeEnd?: string; | ||
layer?: number; | ||
order?: number; | ||
isDummy?: boolean; | ||
} | ||
|
||
export interface NonClusterNode extends BaseNode { | ||
shape?: ShapeID; | ||
isGroup: false; | ||
isEdgeLabel?: boolean; | ||
edgeStart?: string; | ||
edgeEnd?: string; | ||
layer?: number; | ||
order?: number; | ||
isDummy?: boolean; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this be added to base node?
{ | ||
name: 'ipsepCola', | ||
loader: async () => await import('./layout-algorithms/ipsepCola/index.js'), | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow a6d26ef
📑 Summary
🧠 Summary: IPSEP-COLA Layout Algorithm Implementation
This PR introduces a complete implementation of the IPSEP-COLA layout algorithm for structured, layered graph drawing with advanced support for edge labels, self-loops, and group-aware positioning. The algorithm blends Sugiyama-style hierarchy with COLA (Constraint-Based Layout Algorithm) optimization to generate clean and readable diagrams.
🧩 Algorithm Overview
The layout proceeds through the following stages:
Edge Label Insertion
Layer Assignment
Order Assignment
Initial Positioning (X, Y Coordinates)
(x, y)
positions are assigned.COLA-Based Refinement
📏 Design Decisions
📋 Tasks
Make sure you
MERMAID_RELEASE_VERSION
is used for all new features.pnpm changeset
and following the prompts. Changesets that add features should beminor
and those that fix bugs should bepatch
. Please prefix changeset messages withfeat:
,fix:
, orchore:
.