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." .
A NetworkX graph
Source node for which to find the top k
similar other nodes
The number of most similar nodes to return
How long the randomly generated paths should be ( T
in )
A universal positive constant used to scale the number of sample random paths to generate.
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.
The error bound. Per , a good value is sqrt(1/|E|)
. Therefore, if no value is provided, the recommended computed value will be used.
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
.
>>> G = nx.star_graph(10)See :
... sim = nx.panther_similarity(G, 0)
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.similarity.panther_similarity
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