Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Graph::getEdgeWeights

Returns a table with the edge weights.

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Syntax

Graph::getEdgeWeights(G)

Description

Graph::getEdgeWeights(G) returns a table with the edge weights of the graph G. Thus Graph::getEdgeWeights(G) returns the weight of all edges in G.

Note

Weights will most probably only be defined, if transportation problems occur.

Note

If FAIL is returned, no weights were defined (this way both, network and graph algorithms handle this situation correct.)

Examples

Example 1

First lets define a graph without edge weights:

G1 := Graph::createCircleGraph(3):
Graph::getEdgeWeights(G1)

FAIL was returned, because no edge weights were defined.

Graph::getEdges(G1);
G1 := Graph::setEdgeWeights(G1, [[1, 2], [3, 1]], [5, 1/2]):
Graph::getEdgeWeights(G1)

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

Parameters

G

A graph

Return Values

Table

Was this topic helpful?