# Graph::setVertexWeights

Assigns vertex weights to vertices.

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```Graph::setVertexWeights(`G`, `Vertex`, `VertexWeights`)
```

## Description

`Graph::setVertexWeights(G, Vertex, VertexWeights)` returns a graph where the vertices in `Vertex` have the vertex weights `VertexWeights`.

 Note:   The substitute `None` can be used when a specified edge should not get the assigned weights.

## Examples

### Example 1

How to set vertex weights with a list:

```G1 := Graph::createCircleGraph(3): Graph::getVertexWeights(G1)```

`FAIL` was returned, because no vertex weights were defined.

```Graph::getVertices(G1); G1 := Graph::setVertexWeights(G1, [1, 3], [5, 1/2]): Graph::getVertexWeights(G1)```

The first output shows all vertices and the second the assigned vertex weights.

### Example 2

How to set vertex weights with a table:

```G1 := Graph::createCompleteGraph(3): Graph::getVertexWeights(G1)```

`FAIL` was returned, because no vertex weights were defined.

```G2 := Graph::createCompleteGraph(3): tbl := table(1 = 15, 3 = 20): G2 := Graph::setVertexWeights(G2, [1, 3], tbl): Graph::getVertexWeights(G2)```

## Parameters

 `G` A graph `Vertex` A list of one or more vertices `VertexWeights` A list of one or more numbers, or a table consisting of the vertices with their weights.

## Return Values

New graph with the corrected vertex weights.