I have a graph that has determined the Betweenness Centrality value for each vertex. I want to visualize the difference in the centrality value on the graph.

Based on the documentation we can do it with HighlightCentrality, but I did not find the function in Wolfram Mathematica 11.3.

Is there a replacement for this function? Thanks.

reference: https://reference.wolfram.com/language/ref/BetweennessCentrality.html

  • 8
    $\begingroup$ HighlightCentrality is not a library function; it is defined in the documentation page you linked. To use it you need to copy the code to your notebook and execute it. $\endgroup$ – kglr Jan 31 at 1:20

HighlightCentrality is defined in the very same documentation page that you are linking to. It is not a built-in function.

For such visualization tasks, you could also consider IGVertexMap and IGEdgeMap from the IGraph/M package.

GridGraph[{10, 10}, VertexSize -> Large] // 
 IGVertexMap[ColorData["TemperatureMap"], VertexStyle -> Rescale@*BetweennessCentrality]

enter image description here

Here's how it works:

IGVertexMap[fun, prop -> extractor, graph] will store fun /@ extractor[graph] in the vertex property prop for each vertex (in the order given by VertexList).

We can also use the syntax IGVertexMap[fun, prop -> extractor][graph], which makes it easy to chain calls.


Not the answer you're looking for? Browse other questions tagged or ask your own question.