WLJS LogoWLJS Notebook

WeightedAdjacencyGraph

WeightedAdjacencyGraph[wmat] gives the graph with weighted adjacency matrix wmat.

  • WeightedAdjacencyGraph[{v1, v2, ...}, wmat] gives the graph with vertices vi and weighted adjacency matrix wmat.

Examples

Create a weighted graph from a matrix:

WeightedAdjacencyGraph[{{0, 1, 2}, {1, 0, 3}, {2, 3, 0}}]

With named vertices:

WeightedAdjacencyGraph[{"A", "B", "C"}, {{0, 5, 0}, {5, 0, 3}, {0, 3, 0}}]

Please visit the official Wolfram Language Reference for more details.

On this page