networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
k_truss(G, k)

The k-truss is the maximal induced subgraph of G which contains at least three vertices where every edge is incident to at least :None:None:`k-2` triangles.

Notes

A k-clique is a (k-2)-truss and a k-truss is a (k+1)-core.

Not implemented for digraphs or graphs with parallel edges or self loops.

Graph, node, and edge attributes are copied to the subgraph.

K-trusses were originally defined in [2] which states that the k-truss is the maximal induced subgraph where each edge belongs to at least :None:None:`k-2` triangles. A more recent paper, [1], uses a slightly different definition requiring that each edge belong to at least k triangles. This implementation uses the original definition of :None:None:`k-2` triangles.

Parameters

G : NetworkX graph

An undirected graph

k : int

The order of the truss

Raises

NetworkXError

The k-truss is not defined for graphs with self loops or parallel edges or directed graphs.

Returns

H : NetworkX graph

The k-truss subgraph

Returns the k-truss of G.

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