示例#1
0
"""DeepWalk illustrative example."""

import networkx as nx
from karateclub.node_embedding.neighbourhood import DeepWalk

g = nx.newman_watts_strogatz_graph(100, 20, 0.05)

model = DeepWalk()

model.fit(g)
示例#2
0
def deepWalk(population, neighbors, probability):
    g = nx.newman_watts_strogatz_graph(population, neighbors, probability)
    model = DeepWalk()
    model.fit(g)
    #print(model.get_embedding())
    return [model.get_embedding()]