This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
substitute_node_with_subgraph(self, node, other, edge_map_fn, /, node_filter=None, edge_weight_map=None –
Substitute a node with a PyGraph object
node (int) – The node to replace with the PyGraph object
other (PyGraph) – The other graph to replace
edge_map_fn (callable) – A callable object that will take 3 position parameters,
(source, target, weight)to represent an edge either to or from
nodein this graph. The expected return value from this callable is the node index of the node in
otherthat an edge should be to/from. If None is returned, that edge will be skipped and not be copied.
node_filter (callable) – An optional callable object that when used will receive a node’s payload object from
Trueif that node is to be included in the graph or not.
edge_weight_map (callable) – An optional callable object that when used will receive an edge’s weight/data payload from
otherand will return an object to use as the weight for a newly created edge after the edge is mapped from
other. If not specified the weight from the edge in
otherwill be copied by reference and used.
A mapping of node indices in
otherto the equivalent node in this graph.
- Return type:
The return type is a
rustworkx.NodeMapwhich is an unordered type. So it does not provide a deterministic ordering between objects when iterated over (although the same object will have a consistent order when iterated over multiple times).