Beispiel #1
0
def nx_random_features(g: nx.DiGraph, n_feat: int, e_feat: int, g_feat: int):
    for _, ndata in g.nodes(data=True):
        ndata["features"] = torch.randn(n_feat)
    for _, _, edata in g.edges(data=True):
        edata["features"] = torch.randn(e_feat)
    g.data = {"features": torch.randn(g_feat)}
    return g
Beispiel #2
0
    def _default_g(g: nx.DiGraph):
        for _, data in g.nodes(data=True):
            data["features"] = np.zeros((1, ))
            data["target"] = np.zeros((1, ))

        for _, _, data in g.edges(data=True):
            data["features"] = np.zeros((1, ))
            data["target"] = np.zeros((1, ))

        g.data = {"features": np.zeros((1, )), "target": np.zeros((1, ))}
        return g