• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

graphty-org / graphty-element / 15948993626

28 Jun 2025 09:54PM UTC coverage: 73.423% (-4.5%) from 77.956%
15948993626

push

github

apowers313
build: add package linting and remove unused packages

254 of 356 branches covered (71.35%)

Branch coverage included in aggregate %.

1992 of 2703 relevant lines covered (73.7%)

462.07 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.33
/src/layout/MultipartiteLayoutEngine.ts
1
import {Edge as LayoutEdge, multipartiteLayout, Node as LayoutNode} from "@graphty/layout";
1✔
2
import {z} from "zod/v4";
1✔
3

4
import {SimpleLayoutConfig, SimpleLayoutEngine} from "./LayoutEngine";
1✔
5

6
export const MultipartiteLayoutConfig = z.strictObject({
1✔
7
    ... SimpleLayoutConfig.shape,
1✔
8
    // subsetKey: z.string().or(z.record(z.number(), z.array(z.string().or(z.number())))),
9
    subsetKey: z.record(z.string(), z.array(z.string().or(z.number()))),
1✔
10
    align: z.enum(["vertical", "horizontal"]).default("vertical"),
1✔
11
    scale: z.number().positive().default(1),
1✔
12
    center: z.array(z.number()).length(2).or(z.null()).default(null),
1✔
13
});
1✔
14
export type MultipartiteLayoutConfigType = z.infer<typeof MultipartiteLayoutConfig>;
15
export type MultipartiteLayoutOpts = Partial<MultipartiteLayoutConfigType>;
16

17
export class MultipartiteLayout extends SimpleLayoutEngine {
1✔
18
    static type = "multipartite";
1✔
19
    scalingFactor = 40;
1✔
20
    config: MultipartiteLayoutConfigType;
21

22
    constructor(opts: MultipartiteLayoutOpts) {
1✔
23
        super(opts);
×
24
        this.config = MultipartiteLayoutConfig.parse(opts);
×
25
    }
×
26

27
    doLayout(): void {
1✔
28
        this.stale = false;
×
29
        const nodes = () => this._nodes.map((n) => n.id as LayoutNode);
×
30
        const edges = () => this._edges.map((e) => [e.srcId, e.dstId] as LayoutEdge);
×
31

32
        this.positions = multipartiteLayout(
×
33
            {nodes, edges},
×
34
            this.config.subsetKey,
×
35
            this.config.align,
×
36
            this.config.scale,
×
37
            this.config.center,
×
38
        );
×
39
    }
×
40
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc