networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturns
junction_tree(G)

A junction tree (or clique tree) is constructed from a (un)directed graph G. The tree is constructed based on a moralized and triangulated version of G. The tree's nodes consist of maximal cliques and sepsets of the revised graph. The sepset of two cliques is the intersection of the nodes of these cliques, e.g. the sepset of (A,B,C) and (A,C,E,F) is (A,C). These nodes are often called "variables" in this literature. The tree is bipartitie with each sepset connected to its two cliques.

Junction Trees are not unique as the order of clique consideration determines which sepsets are included.

The junction tree algorithm consists of five steps :

  1. Moralize the graph

  2. Triangulate the graph

  3. Find maximal cliques

  4. Build the tree from cliques, connecting cliques with shared nodes, set edge-weight to number of shared variables

  5. Find maximum spanning tree

Parameters

G : networkx.Graph

Directed or undirected graph.

Raises

NetworkXNotImplemented

Raised if G is an instance of MultiGraph or MultiDiGraph .

Returns

junction_tree : networkx.Graph

The corresponding junction tree of G.

Returns a junction tree of a given graph.

Examples

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/decomposition.py#11
type: <class 'function'>
Commit: