Skip to content

Defined in: packages/graph/src/graph.ts:85

The options every graph factory accepts, whatever its layout, so __GRAPH_LAYOUTS[kind](options) constructs any of them.

readonly vertexCount: number

Defined in: packages/graph/src/graph.ts:87

Vertices are the integers 0 … vertexCount - 1. For 1-based input, pass n + 1 and leave vertex 0 isolated.


readonly directed: boolean

Defined in: packages/graph/src/graph.ts:89

Required: guessing it wrong changes every answer.


readonly weighted: boolean

Defined in: packages/graph/src/graph.ts:91

Required: a weighted graph needs a weight on every edge, and an unweighted graph rejects one.


readonly optional parallelEdges?: boolean

Defined in: packages/graph/src/graph.ts:93

Keep every copy of a repeated edge. Defaults to false, where a repeated edge with the same weight is a no-op.


readonly optional selfLoops?: boolean

Defined in: packages/graph/src/graph.ts:95

Allow an edge from a vertex to itself. Defaults to false.


readonly optional edges?: GraphEdges | Iterable<GraphEdgeTuple, any, any>

Defined in: packages/graph/src/graph.ts:101

Edges to add, in order, as [from, to] or [from, to, weight] tuples or as the columns a graph’s edges() returns. On an undirected graph [u, v] and [v, u] are the same edge.