I have a directed graph in NetworkX. Edges are weighted from 0 to 1, representing the probabilities of their occurrence. The network connection is quite large, so I want to trim such edges for each node, only the highest probability of the node remains.
I am not sure how to in_edges over all node and save only the graphs with the greatest weight in_edges . Is there a networkx function that allows us to do this?
Here is an example of what I would like to do.
Nodes: A, B, C, D Edges: A->B, weight=1.0 A->C, weight=1.0 A->D, weight=0.5 B->C, weight=0.9 B->D, weight=0.8 C->D, weight=0.9 Final Result Wanted: A->B, weight=1.0 A->C, weight=1.0 C->D, weight=0.9
If there are two edges in a node and they both have the highest weight, I would like to keep both of them.
source share