Hello everyone,
I have the following weighted adjacency matrix:
M = {{\[Infinity], -164.401, 153.329,
12.4378}, {0.00312139, \[Infinity], \[Infinity], \[Infinity]}, \
{0.0351193, \[Infinity], \[Infinity], \[Infinity]}, {-0.00452402, \
\[Infinity], \[Infinity], \[Infinity]}};
What I want is to make a graph out of it. In order to do that, I have tried the following:
G1 = WeightedAdjacencyGraph[M];
degrees = DegreeCentrality[G1];
edges = EdgeList[G1];
weights = DeleteCases[Flatten[M], \[Infinity]];
G = WeightedAdjacencyGraph[{V, n, m, h}, M, GraphLayout -> Automatic,
PlotTheme -> "Web", VertexLabels -> Placed[Automatic, Center],
VertexSize\[Rule]Thread[VertexList[G1]\[Rule]degrees],
MapThread[
Property[#1,
EdgeStyle -> {ColorData[{"TemperatureMap", "Reverse"}][
Rescale[#2, MinMax[weights], {0, 1}]],
Thickness[
Rescale[#2, MinMax[weights], {0.001, 0.008}]]}] &, {edges,
weights}]]
However, the code gives several errors. Does anyone know how can the code be fixed?
I want the code to return something like this:
But with vertex sizes proportional to their own degree and edge widths and colors proportional to their own weight.
Thank you in advance for any help!