A minimum weight component is an MST + all negative edges

def nx_minimum_weight_component(graph, weight='weight'):
    """ A minimum weight component is an MST + all negative edges """
    mwc = nx.minimum_spanning_tree(graph, weight=weight)
    # negative edges only reduce the total weight
    neg_edges = (e for e, w in nx_gen_edge_attrs(graph, weight) if w < 0)
    mwc.add_edges_from(neg_edges)
    return mwc