hatvis.similarity.vertex_similarity#
- hatvis.similarity.vertex_similarity(H, measure='jaccard', weighted=True, transitive=False, closure='max-product', as_frame=False)[source]#
Vertex similarity matrix \(\mathbf{S}\) (rows and columns follow
H.nodes).A vertex is described by its row of the incidence matrix, scaled by the hyperedge weights when
weighted=True(profile \(a_e=w_e b_{ie}\)). With the default"jaccard"measure this is exactly the similarity of HAT-VIS: \(s_{ik}=\sum_e\min(a_{ie},a_{ke})/\sum_e\max(a_{ie},a_{ke})\).transitive=Truereplaces \(\mathbf{S}\) by its transitive closure (transitive_closure()), so that vertices linked through a chain of similar vertices are also similar.>>> H = Hypergraph.from_incidence([[1, 1, 0], [1, 1, 0], [1, 0, 1], [0, 1, 1], [0, 0, 1]]) >>> vertex_similarity(H).round(3)[0].tolist() [1.0, 1.0, 0.333, 0.333, 0.0] >>> vertex_similarity(H, transitive=True).round(3)[0].tolist() [1.0, 1.0, 0.333, 0.333, 0.167]