In a Salesforce-powered organization, different departments are represented as connected undirected nodes in a network with a total of org_nodes nodes numbered from 1 to org_nodes.
Each node corresponds to a department, and the communication channels between these departments are represented as edges that connect org_from[i] to org_to[i] with associated costs org_weight[i].
The organization needs to optimize its system by removing unnecessary communication channels between departments while maintaining full connectivity, i.e., each entity must be connected to other either directly or through a sequence of channels.
The objective is to determine the maximum possible sum of communication channel costs that can be removed, ensuring the organization's entities remain connected for efficient operations.
Note: All the communication channels (edges) are of bi-directional nature and the associated costs with these edges can be negative as well.
Example: org_nodes = 3, org_edges = 3 org_from = [1, 1, 3] org_to = [2, 3, 1] org_weight = [-2, 4, -1]
In this scenario, it is optimal to remove edge[1] (0-based) (connecting nodes 1 and 3) with weight[1] = 4. No more edges can be removed and still leave the graph connected.
Hence, return 4, since this the only channel removed.
