networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersReturns
join(rooted_trees, label_attribute=None)

Notes

Graph, edge, and node attributes are propagated from the given rooted trees to the created tree. If there are any overlapping graph attributes, those from later trees will overwrite those from earlier trees in the tuple of positional arguments.

Parameters

rooted_trees : list

A list of pairs in which each left element is a NetworkX graph object representing a tree and each right element is the root node of that tree. The nodes of these trees will be relabeled to integers.

label_attribute : str

If provided, the old node labels will be stored in the new tree under this node attribute. If not provided, the node attribute '_old' will store the original label of the node in the rooted trees given in the input.

Returns

NetworkX graph

The rooted tree whose subtrees are the given rooted trees. The new root node is labeled 0. Each non-root node has an attribute, as described under the keyword argument label_attribute , that indicates the label of the original node in the input tree.

Returns a new rooted tree with a root node joined with the roots of each of the given rooted trees.

Examples

>>> h = 4
>>> left = nx.balanced_tree(2, h)
>>> right = nx.balanced_tree(2, h)
>>> joined_tree = nx.join([(left, 0), (right, 0)])
>>> nx.is_isomorphic(joined_tree, nx.balanced_tree(2, h + 1))
True
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/tree/operations.py#11
type: <class 'function'>
Commit: