def test_fgsd(): """ Test the FGSD embedding. """ graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = FGSD() model.fit(graphs) embedding = model.get_embedding() assert embedding.shape[0] == len(graphs) assert embedding.shape[1] == model.hist_bins assert type(embedding) == np.ndarray graphs = [nx.newman_watts_strogatz_graph(150, 5, 0.3) for _ in range(100)] model = FGSD(hist_bins=8) model.fit(graphs) embedding = model.get_embedding() assert embedding.shape[0] == len(graphs) assert embedding.shape[1] == model.hist_bins assert type(embedding) == np.ndarray
#----------------- graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = GL2Vec() model.fit(graphs) model.get_embedding() #-------------- # FGSD example #-------------- graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = FGSD() model.fit(graphs) model.get_embedding() #--------------- # NetMF example #--------------- g = nx.newman_watts_strogatz_graph(100, 20, 0.05) model = NetMF() model.fit(g) model.get_embedding()
graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = GL2Vec() model.fit(graphs) model.get_embedding() quit() #----------------------------------- # FGSD example #----------------------------------- graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = FGSD() model.fit(graphs) model.get_embedding() #----------------------------------- # NetMF example #----------------------------------- g = nx.newman_watts_strogatz_graph(100, 20, 0.05) model = NetMF() model.fit(g) model.get_embedding()
"""FGSD illustrative example.""" import networkx as nx from karateclub.graph_embedding import FGSD graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)] model = FGSD() model.fit(graphs) model.get_embedding()