Closed congrendai closed 9 months ago
Hi @congrendai ,
Each dimension represents a graphlet. The type of a graphlet (the graphlet that corresponds to the 4th dimension in this example) can be obtained as follows:
from grakel import Graph
from grakel.kernels import GraphletSampling
g1 = Graph([[0., 0., 0., 0., 1., 1.],
[0., 0., 1., 1., 0., 0.],
[0., 1., 0., 1., 0., 0.],
[0., 1., 1., 0., 1., 0.],
[1., 0., 0., 1., 0., 0.],
[1., 0., 0., 0., 0., 0.]])
g2 = Graph([[0., 0., 0., 1., 1., 1.],
[0., 0., 1., 0., 0., 0.],
[0., 1., 0., 0., 0., 0.],
[1., 0., 0., 0., 0., 1.],
[1., 0., 0., 0., 0., 1.],
[1., 0., 0., 1., 1., 0.]])
gk = GraphletSampling(k=4, sampling={'n_samples':50}, normalize=False)
K = gk.fit_transform([g1, g2])
print(gk._graph_bins[3])
The output is a graph representation as follows: <(0 0 [1, 2])(1 0 [0])(2 0 [0])(3 0 [])>
. Here node 0 is connected to nodes 1 and 2, while node 3 is connected to no node. From this representation, you can construct a NetworkX graph and then use NetworkX's functions to visualize the graphlet.
Hi, can I know what the graphlets look like and plot them using NetworkX?