• 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.57
/src/layout/SpectralLayoutEngine.ts
1
import {Edge as LayoutEdge, Node as LayoutNode, spectralLayout} from "@graphty/layout";
1✔
2
import {z} from "zod/v4";
1✔
3

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

6
export const SpectralLayoutConfig = z.strictObject({
1✔
7
    ... SimpleLayoutConfig.shape,
1✔
8
    scale: z.number().positive().default(1),
1✔
9
    center: z.array(z.number()).length(2).or(z.null()).default(null),
1✔
10
    dim: z.number().default(2),
1✔
11
});
1✔
12
export type SpectralLayoutConfigType = z.infer<typeof SpectralLayoutConfig>;
13
export type SpectralLayoutOpts = Partial<SpectralLayoutConfigType>;
14

15
export class SpectralLayout extends SimpleLayoutEngine {
1✔
16
    static type = "spectral";
1✔
17
    scalingFactor = 100;
1✔
18
    config: SpectralLayoutConfigType;
19

20
    constructor(opts: SpectralLayoutOpts) {
1✔
21
        super(opts);
×
22
        this.config = SpectralLayoutConfig.parse(opts);
×
23
    }
×
24

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

30
        this.positions = spectralLayout(
×
31
            {nodes, edges},
×
32
            this.config.scale,
×
33
            this.config.center,
×
34
            this.config.dim,
×
35
        );
×
36
    }
×
37
}
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