M.Puk
M.Puk

Reputation: 812

NetworkX betweeness centrality with argument k, endpoints

I would like to ask if there is someone who could explain the meaning of arguments k and endpoints whose can be used for betweeness centrality algorithm in networkx module.

Here is link for source code of betweeness centrality measure in networkx.

Upvotes: 0

Views: 370

Answers (1)

Peter de Rivaz
Peter de Rivaz

Reputation: 33509

k

k is used to determine whether an approximate algorithm is used.

If k is not set, a shortest-path algorithm is run for all starting points in the graph, otherwise the shortest-path algorithm is only run for k random choices of starting point.

k therefore allows you to control the tradeoff between accuracy and speed. A smaller value for k gives you a faster, but more approximate, answer.

endpoints

endpoints is a boolean that controls the definition of distance. Suppose we have points A and B that are linked by an edge. We can think of the shortest path A to B as being 1 edge, or 2 nodes.

Setting endpoints false uses the first definition (counting edges), setting endpoints true uses the second definition (counting nodes).

Upvotes: 2

Related Questions