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


closed as off-topic by m_goldberg, Henrik Schumacher, Carl Lange, MarcoB, Bill Watts Feb 2 at 3:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – m_goldberg, Henrik Schumacher, Carl Lange, MarcoB, Bill Watts
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 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.