Help seeking on calculating betweenness centrality with valued ties

Please place all code into code blocks when posting. You can use the formatting toolbar, or write Markdown, like this: How to use this forum?