There are N bidirectionally connected nodes (Pn), each node represents a value, and there is an attenuation value (0 - 1) between the nodes. Now I want to calculate the maximum value from each node to each node. Each node is calculated only once.
Maybe I didn't express it well, I drew a picture

I want to calculate the sum of the maximum value from each node to a node.
Then repeat to all nodes.
My first thought was brute force traversal, but I'd like to get a faster algorithm
This problem is a bit non-trivial since both negated Dijkstra and Bellman-Ford algorithms can't be used in this case. I think one way to solve this problem is to use the traveling salesman algorithm but instead of finding the minimum path, you find the maximum and also keep track of the maximum distance from the starting point to other vertices (
distancein the below code). The time complexity is O(n!) so it's pretty slow on larger graph. Let me know if you attempted a more efficient algorithm