networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
panther_similarity(G, source, k=5, path_length=5, c=0.5, delta=0.1, eps=None)

Panther is a similarity metric that says "two objects are considered to be similar if they frequently appear on the same paths." .

Parameters

G : NetworkX graph

A NetworkX graph

source : node

Source node for which to find the top k similar other nodes

k : int (default = 5)

The number of most similar nodes to return

path_length : int (default = 5)

How long the randomly generated paths should be ( T in )

c : float (default = 0.5)

A universal positive constant used to scale the number of sample random paths to generate.

delta : float (default = 0.1)

The probability that the similarity $S$ is not an epsilon-approximation to (R, phi), where $R$ is the number of random paths and $\phi$ is the probability that an element sampled from a set $A \subseteq D$, where $D$ is the domain.

eps : float or None (default = None)

The error bound. Per , a good value is sqrt(1/|E|) . Therefore, if no value is provided, the recommended computed value will be used.

Returns

similarity : dictionary

Dictionary of nodes to similarity scores (as floats). Note: the self-similarity (i.e., v ) will not be included in the returned dictionary.

Returns the Panther similarity of nodes in the graph G to node v .

Examples

>>> G = nx.star_graph(10)
... sim = nx.panther_similarity(G, 0)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.similarity.panther_similarity

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