# Graph::setEdgeDescriptions

Assigns edge Descriptions to edges.

### Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

## Syntax

```Graph::setEdgeDescriptions(`G`, `Edge`, `EdgeDescriptions`, <OnlySpecifiedEdges>)
```

## Description

`Graph::setEdgeDescriptions(G, Edges, EdgeDescriptions)` returns a graph where `Edges` have the edge descriptions `EdgeDescriptions`.

 Note:   If OnlySpecifiedEdges is stated and an undirected graph is to be changed, only the edges specified are used and not the inverted ones. For example if a call `Graph::setEdgeDescriptions(G, [[u,v]], [1])` is invoked, only the edge [u, v] gets 1. The edge [v, u] will not be changed.
 Note:   The substitute `None` can be used when a specified edge should not get the assigned description.

## Examples

### Example 1

First lets define a graph without edge descriptions:

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

`FAIL` was returned, because no edge descriptions werde defined.

```Graph::getEdges(G1); G1 := Graph::setEdgeDescriptions(G1, [[1, 2],[3, 1]], ["Route 66", "Speedway"]): Graph::getEdgeDescriptions(G1)```

The first output shows all the edges and the second one the assigned edge descriptions.

```G1 := Graph::setEdgeDescriptions(G1, [[2, 3]], ["Shortcut"]): Graph::getEdgeDescriptions(G1)```

It is easy to see that only the edge description of `[2,3]` was changed.

### Example 2

First lets define a graph without edge Descriptions:

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

`FAIL` was returned, because no edge descriptions werde defined.

```Graph::getEdges(G1); G2 := Graph::setEdgeDescriptions(G1, [[1, 2], [3, 1]], ["Route 66", "Speedway"]): Graph::getEdgeDescriptions(G2)```

The first output shows all the edges (the graph is undirected !) and the second one the assigned edge Descriptions. Not only the specified edges were set, but also the reverted edges.

```Graph::getEdges(G1); G2 := Graph::setEdgeDescriptions(G1, [[1, 2], [3, 1]], ["Route 66", "Speedway"], OnlySpecifiedEdges): Graph::getEdgeDescriptions(G2)```

It is easy to see that only the specified edge Descriptions were changed and not the reverted edges, too.

### Example 3

There exist also the possibility to set the Descriptions via a table instead of a list.

```tbl := table([1, 2] = "Highway", [1, 3] = "Road to nowhere"): G2 := Graph::createCompleteGraph(3): Graph::getEdgeDescriptions(G2):```
```G2 := Graph::setEdgeDescriptions(G2, [[1, 2], [3, 1]], tbl): Graph::getEdgeDescriptions(G2)```

And again, but this time only the specified edges:

```tbl := table([1, 2] = "Highway", [1, 3] = "Road to nowhere"): G2 := Graph::createCompleteGraph(3): Graph::getEdgeDescriptions(G2): G2 := Graph::setEdgeDescriptions(G2, [[1, 2], [3, 1]], tbl, OnlySpecifiedEdges): Graph::getEdgeDescriptions(G2)```

## Parameters

 `G` A graph `Edge` A list of one or more edges `EdgeDescriptions` A list of one or more numbers, or a table consisting of the edges with their descriptions.

## Options

 `OnlySpecifiedEdges` Only the edges specified in `Edge` will be set.

## Return Values

New graph with the corrected edge Descriptions.