Skip to content

WeightedAdjacencyMatrix

WeightedAdjacencyMatrix(graph)

convert the graph into a weighted adjacency matrix in sparse array format.

See:

Examples

The sparse array can be converted to an adjacency matrix in List format with the Normal function:

>> WeightedAdjacencyMatrix(Graph({1 -> 2, 2 -> 3, 1 -> 3, 4 -> 2}, EdgeWeight->{5.061,2.282,5.086,1.707})) // Normal
{{0,5.061,5.086,0},\
{0,0,2.282,0},
{0,0,0,0},
{0,1.707,0,0}}

AdjacencyMatrix, GraphCenter, GraphDiameter, GraphPeriphery, GraphRadius, EdgeList, EdgeQ, EulerianGraphQ, FindEulerianCycle, FindHamiltonianCycle, FindVertexCover, FindShortestPath, FindSpanningTree, Graph, GraphQ, HamiltonianGraphQ, Normal, VertexEccentricity, VertexList, VertexQ

Implementation status

  • ✅ - full supported

Github