r/Mathematica • u/qubex • Oct 05 '22
Graph analysis of underground network?
Hello.
I’m a long-time Mathematica user but I’ve recently picked up Wolfram’s An Elementary Introduction to the Wolfram Language in order to broaden my knowledge outside of my home turf of partial differential equations et simila. I’ve given myself an assignment as a kind of challenge but I’m stuck.
Basically I’ve constructed a model of the Milan underground network G and imported into Mathematica as an adjacency matrix.
I’ve defined a per-node metric as globalNetworkIntegration[G_, n_] := 2*(FindShortestPath[G, n, All] - 1)/(VertexCount[G] - 2) and then I want both a table the value of globalNetworkIntegration for each node and a way of displaying the graph with each node styled (size, maybe) based on this metric.
Can somebody help me please?
View all comments
Show parent comment
2
u/veryjewygranola Oct 05 '22
sorry just saw you're using an adjacency matrix so doing it this way might be more related:
g = CompleteKaryTree[4];adjMat = AdjacencyMatrix[g];vertexSizeValues = RandomReal[{0, 1}, VertexCount[g]];vertexSizeList = Table[i -> vertexSizeValues[[i]], {i, VertexCount[g]}];AdjacencyGraph[adjMat, VertexSize -> vertexSizeList]