-
-
Notifications
You must be signed in to change notification settings - Fork 381
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(layout-engine): invalid hierarchical layout (#77)
* test(layout-engine): add failing test for this issue * fix(layout-engine): generate valid hierarchical layouts TODO: This is very slow at the moment, it needs to be optimized for better performance in production. * chore(dist): update * fix(layout-engine): position directed hierarchy to the bottom This mostly minimizes the amount of levels edges span between two nodes. * chore(dist): update * chore(layout-engine): remove unused code * perf(layout-engine): improve level determination perf In my tests up to 2500 % improvement in performance depending on the size and structure of the graph. * perf(layout-engine): use faster cycle detection Cycles are detected as the levels are being filled. This get's rid of the incredibly slow O(V²*E) cycle detection. Still uses the same fallback logic for cyclic “hierarchies”. * chore(dist): update * test(layout-engine): add one more test case * fix(layout-engine): ignore circular edges in hierarchical layout * test(layout-engine): randomize edge order * style(layout-engine): refomat new files * chore(dist): update * chore(dist): update
- Loading branch information
Showing
16 changed files
with
859 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
declare type Levels = Record<string | number, number>; | ||
interface Edge { | ||
connected: boolean; | ||
from: Node; | ||
fromId: string | number; | ||
to: Node; | ||
toId: string | number; | ||
} | ||
interface Node { | ||
id: string | number; | ||
edges: Edge[]; | ||
} | ||
/** | ||
* Assign levels to nodes according to their positions in the hierarchy. | ||
* | ||
* @param nodes - Nodes of the graph. | ||
* @param levels - If present levels will be added to it, if not a new object will be created. | ||
* | ||
* @returns Populated node levels. | ||
*/ | ||
export declare function fillLevelsByDirection(nodes: Node[], levels?: Levels): Levels; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.