graph-builder
Version:
A graph builder library for modeling abstract graph structures.
25 lines (16 loc) • 813 B
Markdown
[Home](./index) > [graph-builder](./graph-builder.md) > [ValueGraph](./graph-builder.valuegraph.md) > [edgeValueOrDefault](./graph-builder.valuegraph.edgevalueordefault.md)
# ValueGraph.edgeValueOrDefault method
Returns the value of the edge that connects `nodeU` to `nodeV`<!-- -->, if one is present; otherwise, returns `defaultValue`<!-- -->.
In an undirected graph, this is equal to `edgeValueOrDefault(nodeV, nodeU, defaultValue)`<!-- -->.
Throws if `nodeU` or `nodeV` is not an element of this graph.
**Signature:**
```javascript
edgeValueOrDefault<R>(nodeU: N, nodeV: N, defaultValue: R): V | R;
```
**Returns:** `V | R`
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| `nodeU` | `N` | |
| `nodeV` | `N` | |
| `defaultValue` | `R` | |