calculate the similarity index of the label graph pairs package in python.
Can be used for weighted/unweighted and directed/undirected networks.
Installation can be done through pip. You must have python version >= 3.8
pip install similarity-index-of-label-graph
The statement to import the package:
from similarity_index_of_label_graph_package import similarity_index_of_label_graph_class
Example:
>>> from networkx.generators.directed import gnr_graph
>>> from networkx.generators import spectral_graph_forge
>>> G1 = gnr_graph(100, 0.3, seed = 65535)
>>> G2 = gnr_graph(100, 0.3, seed = 1)
>>> G3 = spectral_graph_forge(G1, 0.6, seed = 65535)
>>> G4 = spectral_graph_forge(G2, 0.6, seed = 65535)
>>> similarity_index_of_label_graph = similarity_index_of_label_graph_class()
>>> similarity_index_of_label_graph(G1, G2)
0.7651719671571124
>>> similarity_index_of_label_graph(G1, G3)
-0.8580896120374933
>>> similarity_index_of_label_graph(G2, G4)
-0.8440113193737153
>>> similarity_index_of_label_graph(G3, G4)
0.7314483604914666