schrodinger.thirdparty.networkx_algos module¶
- schrodinger.thirdparty.networkx_algos.get_subgraphs(g: networkx.classes.multigraph.MultiGraph, root, *, node_weight_map=None, max_weight: float = inf) Iterable[networkx.classes.multigraph.MultiGraph] ¶
Return a generator over all subgraphs of
g
weighing at mostmax_weight
and with rootroot
For every iteration of this generator, a
nx.MultiGraph
will be yielded that is a subgraph ofg
. The samenx.MultiGraph
is used for every iteration so if you need to save the state of the subgraph, make a copy of it (subgraph.copy()
).All nodes are given a default weight of 1. If
node_weight_map
is supplied, weights of nodes are determined by looking them up in the map. If they are not found in the map, the default of 1 is used.
- schrodinger.thirdparty.networkx_algos.get_subtrees(g: networkx.classes.multigraph.MultiGraph, root, *, node_weight_map=None, max_weight: float = inf) Iterable[networkx.classes.multigraph.MultiGraph] ¶
Return a generator over all subtrees of
g
weighing at mostmax_weight
and with rootroot
For every iteration of this generator, a
nx.MultiGraph
will be yielded that is a subtree ofg
. The samenx.MultiGraph
is used for every iteration so if you need to save the state of the subtree, make a copy of it (subtree.copy()
).All nodes are given a default weight of 1. If
node_weight_map
is supplied, weights of nodes are determined by looking them up in the map. If they are not found in the map, the default of 1 is used.