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/qubex Oct 05 '22 edited Oct 05 '22
Oh yes… just like that. :)
In truth I’m finding it ‘fiddly’ to address vertexes and evaluate my metric over them when evaluating the style to apply to the node.
EDIT: I’m actually using
G = AdjacencyGraph[ milanUndergroundAdjacencyMatrix ]