# GraphOptions

Defined in: [packages/graph/src/graph.ts:85](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L85)

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

## Properties

### vertexCount

> `readonly` **vertexCount**: `number`

Defined in: [packages/graph/src/graph.ts:87](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L87)

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

***

### directed

> `readonly` **directed**: `boolean`

Defined in: [packages/graph/src/graph.ts:89](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L89)

Required: guessing it wrong changes every answer.

***

### weighted

> `readonly` **weighted**: `boolean`

Defined in: [packages/graph/src/graph.ts:91](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L91)

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

***

### parallelEdges?

> `readonly` `optional` **parallelEdges?**: `boolean`

Defined in: [packages/graph/src/graph.ts:93](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L93)

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

***

### selfLoops?

> `readonly` `optional` **selfLoops?**: `boolean`

Defined in: [packages/graph/src/graph.ts:95](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L95)

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

***

### edges?

> `readonly` `optional` **edges?**: [`GraphEdges`](/reference/knotkit/graph/interfaces/graphedges/) | `Iterable`<[`GraphEdgeTuple`](/reference/knotkit/graph/type-aliases/graphedgetuple/), `any`, `any`>

Defined in: [packages/graph/src/graph.ts:101](https://github.com/jkomyno/knotkit/blob/ef04dc6fd5182dca281abddf3e1dcb13118c15a4/packages/graph/src/graph.ts#L101)

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.
