Ejemplo n.º 1
0
def test_feather_graph():
    """
    Test the graph level FEATHER embedding.
    """
    graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)]

    model = FeatherGraph()

    model.fit(graphs)
    embedding = model.get_embedding()

    assert embedding.shape[0] == len(graphs)
    assert embedding.shape[1] == 4 * model.order * model.eval_points
    assert type(embedding) == np.ndarray

    graphs = [nx.newman_watts_strogatz_graph(150, 5, 0.3) for _ in range(100)]

    model = FeatherGraph(order=3)

    model.fit(graphs)
    embedding = model.get_embedding()

    assert embedding.shape[0] == len(graphs)
    assert embedding.shape[1] == 4 * model.order * model.eval_points
    assert type(embedding) == np.ndarray
Ejemplo n.º 2
0
g = nx.newman_watts_strogatz_graph(150, 10, 0.2)

X = np.random.uniform(0, 1, (150, 127))

model = FeatherNode()

model.fit(g, X)
embedding = model.get_embedding()

#----------------
# Feather Graph
#----------------

graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(100)]

model = FeatherGraph()

model.fit(graphs)
embedding = model.get_embedding()

#----------------
# GEMSEC example
#----------------

g = nx.newman_watts_strogatz_graph(50, 5, 0.05)

model = GEMSEC()

model.fit(g)
memberships = model.get_memberships()
Ejemplo n.º 3
0
"""FeatherGraph illustrative example."""

import networkx as nx
from karateclub.graph_embedding import FeatherGraph

graphs = [nx.newman_watts_strogatz_graph(50, 5, 0.3) for _ in range(1000)]

model = FeatherGraph()

model.fit(graphs)
model.get_embedding()