Coder Social home page Coder Social logo

benedekrozemberczki / graph2vec Goto Github PK

View Code? Open in Web Editor NEW
879.0 879.0 167.0 222 KB

A parallel implementation of "graph2vec: Learning Distributed Representations of Graphs" (MLGWorkshop 2017).

Home Page: https://karateclub.readthedocs.io/

License: GNU General Public License v3.0

Python 100.00%
deepwalk diff2vec gemsec graph-embedding graph-kernel graph-wavelet graph2vec implicit-matrix-factorization kernel machine-learning matrix-factorization node-embedding node2vec noise-contrastive-estimation struc2vec subgraph2vec transformer unsupervised-learning weisfeiler-lehman word2vec

graph2vec's Introduction

Benedek A. Rozemberczki/ Homepage / Twitter / GitHub / Google Scholar

Welcome stranger

  • ⏰ Currently working on machine learning for drug discovery.
  • πŸ€– I would love to collaborate on the machine learning libraries ChemicalX and RexMex.

Great news

graph2vec's People

Contributors

5teven1in avatar benedekrozemberczki avatar chamath-eka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graph2vec's Issues

error while running main

I installed all the dependencies as specified in the README and ran the example as given in the repo. I get the following error:

0it [00:00, ?it/s]Feature extraction started.



/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/doc2vec.py:566: UserWarning: The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.
Optimization started.

  warnings.warn("The parameter `iter` is deprecated, will be removed in 4.0.0, use `epochs` instead.")
/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/doc2vec.py:570: UserWarning: The parameter `size` is deprecated, will be removed in 4.0.0, use `vector_size` instead.
  warnings.warn("The parameter `size` is deprecated, will be removed in 4.0.0, use `vector_size` instead.")
2018-11-10 21:59:24,869 : INFO : collecting all words and their counts
2018-11-10 21:59:24,869 : INFO : collected 0 word types and 0 unique tags from a corpus of 0 examples and 0 words
2018-11-10 21:59:24,869 : INFO : Loading a fresh vocabulary
2018-11-10 21:59:24,869 : INFO : effective_min_count=5 retains 0 unique words (0% of original 0, drops 0)
2018-11-10 21:59:24,869 : INFO : effective_min_count=5 leaves 0 word corpus (0% of original 0, drops 0)
2018-11-10 21:59:24,869 : INFO : deleting the raw counts dictionary of 0 items
2018-11-10 21:59:24,869 : INFO : sample=0.0001 downsamples 0 most-common words
2018-11-10 21:59:24,869 : INFO : downsampling leaves estimated 0 word corpus (0.0% of prior 0)
2018-11-10 21:59:24,869 : INFO : estimated required memory for 0 words and 128 dimensions: 0 bytes
2018-11-10 21:59:24,869 : INFO : resetting layer weights
Traceback (most recent call last):
  File "/datadisk/Workspace/test/graph2vec/src/graph2vec.py", line 131, in <module>
    main(args)
  File "/datadisk/Workspace/test/graph2vec/src/graph2vec.py", line 125, in main
    alpha = args.learning_rate)
  File "/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/doc2vec.py", line 615, in __init__
    end_alpha=self.min_alpha, callbacks=callbacks)
  File "/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/doc2vec.py", line 795, in train
    queue_factor=queue_factor, report_delay=report_delay, callbacks=callbacks, **kwargs)
  File "/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 1081, in train
    **kwargs)
  File "/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 536, in train
    total_words=total_words, **kwargs)
  File "/datadisk/Workspace/test/graph2vec/venv/lib/python3.6/site-packages/gensim/models/base_any2vec.py", line 1187, in _check_training_sanity
    raise RuntimeError("you must first build vocabulary before training the model")
RuntimeError: you must first build vocabulary before training the model

Process finished with exit code 1

Any suggestion what could be going wrong?

Visualisation of graph2vec embeddings in a network

Hello,

Is it possible to see the network resulting from the DeepWalk embedding of a graph2vec dataset?

The aim is to bring together the nodes that are most connected in order to ease their vizualisation.

Many thanks in advance,

Nicolas

ValueError: 11 columns passed, passed data had 14 columns

Hello, I am trying to run graph2vec on my own dataset. It seems like each graph will use different values of dimensions, as I encountered the following error during my run:

Traceback (most recent call last): File "graph2vec.py", line 137, in <module> main(args) File "graph2vec.py", line 133, in main save_embedding(args.output_path, model, graphs, args.dimensions) File "graph2vec.py", line 106, in save_embedding out = pd.DataFrame(out, columns=column_names) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\frame.py", line 474, in __init__ arrays, columns = to_arrays(data, columns, dtype=dtype) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 461, in to_arrays return _list_to_arrays(data, columns, coerce_float=coerce_float, dtype=dtype) File "C:\ProgramData\Anaconda3\lib\site-packages\pandas\core\internals\construction.py", line 500, in _list_to_arrays raise ValueError(e) from e ValueError: 11 columns passed, passed data had 14 columns
Could you please suggest how to solve this problem?

node and edge attributes

how do we account for node and edge attributes? I read your answers where you mentioned we have to use a hash function, but I don't know how to do so, could you please help?

[Question] Add PyPi package

Hi, I find this package very interesting.
I was wondering if this could be added as a package in PyPI so that it can be easily installed/used inside larger projects.

Greetings

multiple features

If each node has many features instead of one, for example , {"edges": [[0, 1], [0, 2]], "features": {"0": "7,3,4", "1": "8,3,5", "2": "9,2,7"}} , how can I represent the dataset as input? Thank you.

Question about embeddings

Hello,
My goal is to use this model to obtain the graphs embeddings and use these to create a training set for another machine learning model. Is this correct? However, after training graph2vec on my custom dataset, how do I get the embeddings of an previously unseen graphs, i.e. a graph that are not in the training set?

Questions for some use cases

Hi, thanks for the great code.

Let me ask the followings.
I want to use multiple dimension vectors for the features.
For example, I want to input like this:
{"edges":[[0, 1]], "features": {"0": ["0.1", "0.1"], "1": ["0.0", "0.1"]}
Can we do it?

One more thing.
Can we save the model and use it for another input data which is not used for training and output the result CSV for it?

Best regards.

ValueError: invalid literal for int() with base 10: 'dataset\\0'

Cloned the repository and ran as-is with defaults and given sample data. Completes feature extraction ok but then getting the following error when it starts the optimization step:

Optimization started.

Traceback (most recent call last):
  File "src/graph2vec.py", line 129, in <module>
    main(args)
  File "src/graph2vec.py", line 125, in main
    save_embedding(args.output_path, model, graphs, args.dimensions)
  File "src/graph2vec.py", line 98, in save_embedding
    out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
ValueError: invalid literal for int() with base 10: 'dataset\\0'

Perhaps passing 'dataset\0' as identifier rather than 0?

Input JSON

I was having trouble running the script when the input dictionaries had no 'feature' key. Running the script would return this error:

'DegreeView' object has no attribute 'items'

I'm not the most experienced programmer so I could be wrong here but I think in networkx 2.4 networkx.Graph.degree returns an iterable and not a dict. So in line 72 of graph2vec.py, I had to consider the case when features was an iterable so I changed features.items() to list(features). And this worked for input dictionaries with no feature key so it now looks like:

if "features" in data.keys():
    features = data["features"]
    features = {int(k): v for k, v in features.items()}
else:
    features = nx.degree(graph)
    features = {int(k): v for k, v in list(features)}

Maybe I'm completely wrong but just in case anyone else had the same issue this might help since this worked for me.

features = {int(k): v for k, v in features.items()}

Error on executing graph2vec.py

After installing all required packages and executing the graph2vec.py i got the following error.
Any help is more than welcome

python src/graph2vec.py
Traceback (most recent call last):
  File "src/graph2vec.py", line 10, in <module>
    from joblib import Parallel, delayed
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/__init__.py", line 119, in <module>
    from .parallel import Parallel
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/parallel.py", line 28, in <module>
    from ._parallel_backends import (FallbackToBackend, MultiprocessingBackend,
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 22, in <module>
    from .executor import get_memmapping_executor
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/executor.py", line 14, in <module>
    from .externals.loky.reusable_executor import get_reusable_executor
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/externals/loky/__init__.py", line 12, in <module>
    from .backend.reduction import set_loky_pickler
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/externals/loky/backend/reduction.py", line 125, in <module>
    from joblib.externals import cloudpickle  # noqa: F401
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/externals/cloudpickle/__init__.py", line 3, in <module>
    from .cloudpickle import *
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/externals/cloudpickle/cloudpickle.py", line 167, in <module>
    _cell_set_template_code = _make_cell_set_template_code()
  File "/home/eleni/Documents/PythonProjects/graph2vec/venv/lib/python3.8/site-packages/joblib/externals/cloudpickle/cloudpickle.py", line 148, in _make_cell_set_template_code
    return types.CodeType(
TypeError: an integer is required (got type bytes)

Graph2Vec datasets

Hi,

Graph2Vec has wide applications but I don't find many datasets about graphs to make experiments and prove its efficiency.

Do you have a list of applicable datasets?

Many thanks in advance,

Nicolas

Edge Features

Hi, I am planning on using graph2vec for a research project. Am I right that this implementation does not allow for edge features to be included e.g. edge weights?
Thanks.

worse results with latest version

Installing the latest version, I am getting worse results than with an earlier version for the same experiment.
The issue seems to be with line 104 of graph2vec.py:
out.append([identifier] + list(model.docvecs["g_"+identifier]))
changing to:
out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
solved the issue for me.

error with custom data

I've changed my data as your dataset format, and check the name of files are integer and all of them json validated but got this error.

Feature extraction started.

100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 741/741 [00:00<00:00, 819.88it/s]
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 418, in _process_worker
    r = call_item()
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/externals/loky/process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/_parallel_backends.py", line 567, in __call__
    return self.func(*args, **kwargs)
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/parallel.py", line 225, in __call__
    for func, args, kwargs in self.items]
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/parallel.py", line 225, in <listcomp>
    for func, args, kwargs in self.items]
  File "src/graph2vec.py", line 84, in feature_extractor
    graph, features, name = dataset_reader(path)
  File "src/graph2vec.py", line 67, in dataset_reader
    graph = nx.from_edgelist(data["edges"])
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/networkx/convert.py", line 390, in from_edgelist
    G.add_edges_from(edgelist)
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/networkx/classes/graph.py", line 969, in add_edges_from
    "Edge tuple %s must be a 2-tuple or 3-tuple." % (e,))
networkx.exception.NetworkXError: Edge tuple [] must be a 2-tuple or 3-tuple.
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src/graph2vec.py", line 131, in <module>
    main(args)
  File "src/graph2vec.py", line 115, in main
    document_collections = Parallel(n_jobs = args.workers)(delayed(feature_extractor)(g, args.wl_iterations) for g in tqdm(graphs))
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/parallel.py", line 934, in __call__
    self.retrieve()
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/parallel.py", line 833, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/site-packages/joblib/_parallel_backends.py", line 521, in wrap_future_result
    return future.result(timeout=timeout)
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/concurrent/futures/_base.py", line 425, in result
    return self.__get_result()
  File "/Users/EUGENE/anaconda3/envs/thesis/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
networkx.exception.NetworkXError: Edge tuple [] must be a 2-tuple or 3-tuple.

attaching one of my json files.

0101.json
{"edges": [[2, 3], [3, 4], [3, 5], [4, 8], [4, 10], [5, 6], [5, 16], [6, 22], [6, 114], [8, 9], [9, 17], [9, 18], [10, 20], [10, 61], [10, 21], [11, 12], [11, 13], [12, 66], [12, 78], [13, 14], [13, 15], [16, 24], [16, 25], [17, 26], [17, 28], [18, 19], [19, 29], [19, 30], [20, 93], [21, 33], [21, 35], [22, 23], [23, 36], [23, 37], [24, 38], [24, 40], [25, 43], [25, 41], [25, 44], [25, 45], [26, 27], [27, 46], [27, 47], [28, 51], [29, 52], [29, 53], [30, 54], [30, 92], [32, 58], [32, 64], [33, 34], [34, 68], [34, 79], [35, 76], [35, 80], [36, 11], [37, 11], [38, 39], [39, 82], [39, 87], [40, 115], [40, 83], [47, 48], [48, 49], [48, 50], [49, 25], [50, 81], [54, 55], [55, 94], [55, 98], [55, 107], [56, 57], [56, 60], [58, 59], [59, 62], [59, 63], [61, 104], [61, 106], [64, 65], [65, 102], [66, 70], [66, 74], [70, 71], [71, 72], [71, 103], [79, 86], [79, 88], [83, 85], [83, 84], [88, 89], [89, 90], [89, 91], [92, 56], [93, 31], [93, 32], [94, 96], [94, 100], [96, 97], [104, 105], [105, 107], [105, 109], [106, 111], [106, 113], [109, 110], [111, 112], [114, 61]], "features": {"2": "1", "3": "3", "4": "3", "5": "3", "8": "2", "10": "4", "6": "3", "16": "3", "22": "2", "114": "2", "9": "3", "17": "3", "18": "2", "20": "2", "61": "4", "21": "3", "11": "4", "12": "3", "13": "3", "66": "3", "78": "1", "14": "1", "15": "1", "24": "3", "25": "6", "26": "2", "28": "2", "19": "3", "29": "3", "30": "3", "93": "3", "33": "2", "35": "3", "23": "3", "36": "2", "37": "2", "38": "2", "40": "3", "43": "1", "41": "1", "44": "1", "45": "1", "27": "3", "46": "1", "47": "2", "51": "1", "52": "1", "53": "1", "54": "2", "92": "2", "32": "3", "58": "2", "64": "2", "34": "3", "68": "1", "79": "3", "76": "1", "80": "1", "39": "3", "82": "1", "87": "1", "115": "1", "83": "3", "48": "3", "49": "2", "50": "2", "81": "1", "55": "4", "94": "3", "98": "1", "107": "2", "56": "3", "57": "1", "60": "1", "59": "3", "62": "1", "63": "1", "104": "2", "106": "3", "65": "2", "102": "1", "70": "2", "74": "1", "71": "3", "72": "1", "103": "1", "86": "1", "88": "2", "85": "1", "84": "1", "89": "3", "90": "1", "91": "1", "31": "1", "96": "2", "100": "1", "97": "1", "105": "3", "109": "2", "111": "2", "113": "1", "110": "1", "112": "1"}}

Using one example

If I use graph2vec on a dataset is there any way I can save the model and use it on one example?

Correct Multiset Calculation

Thanks for your work on this library. I was looking through the code after I applied this to my own dataset and noticed a potential issue with the calculation of the label multiset in the WeisfeilerLehmanMachine.

In the original paper they provide this figure to explain one iteration of the relabeling process(p. 10):
Screen Shot 2019-07-28 at 2 12 43 PM

In particular, the node with label 4 in the left graph has a pre-hashed label of 4,1135 - meaning it's original label is 4, and the multiset representation of its neighbors labels is 1135

I think there's an issue in how this multiset is calculated in the WeisfeilerLehmanMachine class, specifically this line: https://github.com/benedekrozemberczki/graph2vec/blob/master/src/graph2vec.py#L42

I've got a simple reproduction of this logic here. I am expecting the output to be 4_1_1_3_5, however, I get:

>>> node_label = "4"
>>> neighbor_labels = ["5", "3", "1", "1"]
>>> features = "_".join([node_label] + list(set(sorted([str(n) for n in neighbor_labels]))))
>>> print(features)
4_5_1_3

I believe you can fix this by removing the creation of the set, I'm not sure that's doing what we want. Since sets are unordered collections of objects, we are effectively ordering the objects with sorted and then unordering them with set.

I could be wrong as I didn't evaluate the full pipliene here - there maybe some other change in the input to this function that does give you the correct answer, but I think this part of the implementation is worth another look.

Different number node and edge

Hi,
I'm facing the problems about number of nodes and edges, I have 7 nodes but just have 6 edges. I'm facing the error: joblib.externals.loky.process_executor._RemoteTraceback: self.do_recursions(). How to implement graph2vec?

Graph2vec for graph similarity learning

I am thinking to use Graph2vec for learning graph similarity learning.

Given two graphs, I am thinking to get embeddings of the two graphs and then take the cosine similarity of the two graphs.

May graphs would have around 5000 nodes and 4000 edges.

Is Graph2vec a good fit for this task?

Choosing the right embedding dimension

Hi,
i am currently trying to figure out what dimension size to choose for my graph database.
Thats because I have relative small graphs with in average 7 (with predicates 14) nodes and 21 edges.
So with my calculation I come to an extracted_features size of 21 for each input graph, using wl_iteration of 2.
I'm using following formula for this:

num(extracted_feature) = num(nodes) + num(nodes) * wl_iterations 

So this means in words of doc2vec, that each document has 21 words. Am i right in this point?
Because that seems a bit low to me, i wonder which dimension size to choose. Which dimension size should I use for this setup? A dimension size of 128 for me seems too high.

Greetings and thanks for this great work,
Christian

subgrahs

Can I use graph2vec to represent subgraphs(that contain two nodes or three) as vectors then I will cluster these subgraphs to N number clusters using K-means or Dbscan algorithms Is it a logical process ?

Thanks very much .

Graph2vec infer

Hi, I am trying to use the infer method to test my graph2vec embedding without retraining the model. I follow these steps

graphs_train = list of networkx graphs
graphs_test = list of networkx graphs
g2v_emb = g2v.Graph2Vec()
g2v_emb.fit(graphs_train)
test_emb = g2v_emb.infer(graphs_test)

However, this returns a list that looks like this: ['9', '595be5e4bb7167f35a2878342bed1787', '00129eb2ff1730f9d0db0e5e3ecb7059', '5', '92dd168e872bef807dc1617ddd3f4bd3', ...]. Any idea of where I am going wrong here?

Also, thank you for this repository, this code has been very helpful!

ValueError while using the default Dataset

I was having trouble using the tool with my dataset, so I tried using the default dataset using the following command:

python src/graph2vec.py --dimensions 32

But even on the default dataset provided, I get the following error:

Traceback (most recent call last):
  File "src/graph2vec.py", line 129, in <module>
    main(args)
  File "src/graph2vec.py", line 125, in main
    save_embedding(args.output_path, model, graphs, args.dimensions)
  File "src/graph2vec.py", line 98, in save_embedding
    out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
ValueError: invalid literal for int() with base 10: 'dataset\\0'

I tried fixing the error for the string format, but that raises some KeyErrors. Could I kindly get some assistance with this?

Edit: I have attached the KeyError below:

Traceback (most recent call last):
  File "src/graph2vec.py", line 130, in <module>
    main(args)
  File "src/graph2vec.py", line 126, in main
    save_embedding(args.output_path, model, graphs, args.dimensions)
  File "src/graph2vec.py", line 99, in save_embedding
    out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
  File "C:\AppData\Local\Programs\Python\Python37\lib\site-packages\gensim\models\keyedvectors.py", line 1613, in __getitem__
    raise KeyError("tag '%s' not seen in training corpus/invalid" % index)
KeyError: "tag 'g_0' not seen in training corpus/invalid"

Thank you

json file reading

Dear benedekrozemberczki,
I’m a student in Computer Science, from the University of Salerno.
I’m dealing with your graph2vec implementation after reading the related article, which I found very interesting.
When trying to run your code, I find a little bug.
Here below you can find the error and my fix.
parser.add_argument("--input-path", nargs="?", default="../dataset", help="Input folder with jsons.")

parser.add_argument("--output-path", nargs="?", default="../features/nci2.csv", help="Embeddings path.")
at line 111 of the script graph2vec, the variable global was empty, so without the json files of the dataset folder.
graphs = glob.glob(args.input_path + "*.json")

I rewrite the code in this way to extract the files into the directory:

graphs = []
pathfilename = args.input_path
for files in os.listdir(pathfilename):
graphs.append(pathfilename + '/' + files)

Hope this will help you :D
Given Graph2vec will be a main part of my thesis, don’t you mind if I contact you in case of difficulties?

Kind regards,
Gerardo "Dino" Benevento

comparing with original software package and citation

Dear author,
I want to ask, since the software is not the original graph2vec implementation, is this version of implementation generating same result comparing to the original version released by the author of the paper?
And If I used this work, except that paper, what else can I cite to show that I used your or got some idea from your software?

Thanks

can't improve my problem when add graph struct

I embedded the graph learned by Graph2VEc as the input data of neural network, and connect the sequence feature information learned by other LSTM, but the effect was always worse than embedding without graph structure and only using LSTM.Why is that?

Node Features

Hi every body
I have a question about node features, as default this features set by node degree, I replace it with a list as below for example:
{"edges": [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]], "features": {"1": 3, "2": 3, "3": 3, "4": 3}}
replace by
{"edges": [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]], "features": {"1": [3,1], "2": [3,1], "3": [3,1], "4": [3,1]}}

but I get error :
RuntimeError: you must first build vocabulary before training the model

How can I use a list as node features in input of algorithm?
I would be very thankful if you guide me.

Small question

Hi Benedek,

First of all, massive amounts of kudos for all the implementations I discovered from you today. Strong work!

Concerning this graph2vec algorithm... At first glance, it seems identical to the rdf2vec algorithm (with the Weisfeiler-Lehman extension), except for the fact that this algorithm cannot deal with named edges (only named nodes). Am I correct, or is there a significant difference that I am currently not seeing?

Also, nice implementation of the WL relabeling!

Thanks and kind regards,
Gilles

KeyError: "tag 'g_0' not seen in training corpus/invalid"

Hi, I'm trying to run the program as indicated in the readme file, from the graph2vec-master directory:
python src/graph2vec.py

However, I get the following error:
`Feature extraction started.

100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 51/51 [00:05<00:00, 9.59it/s]

Optimization started.

Traceback (most recent call last):
File "src/graph2vec.py", line 129, in
main(args)
File "src/graph2vec.py", line 125, in main
save_embedding(args.output_path, model, graphs, args.dimensions)
File "src/graph2vec.py", line 98, in save_embedding
out.append([int(identifier)] + list(model.docvecs["g_"+identifier]))
File "c:\users\owner\appdata\local\programs\python\python37\lib\site-packages\gensim\models\keyedvectors.py", line 1600, in getitem
raise KeyError("tag '%s' not seen in training corpus/invalid" % index)
KeyError: "tag 'g_0' not seen in training corpus/invalid"`

I edited the default dataset path (from "/" to "\") to make it work with Windows. That's all the edit I've done. As you can see, I'm using Python 3.7. `
Any ideas on what can be causing this error?

Question about the outputed embedding

Hi,

I actually find that if I put several completely same graphs into graph2vec, the outputed embeddings are not the same. To be specific, I replicated several 0.json in /dataset and run the training and I found that the outputed embeddings were different.

I wonder whether this is the correct output.

multiple node feature?

Hi,
how can i use multiple node feature for each node?. In the example only use one.
Thank's.

Input data

Sorry for the question, but I don't know how create a json file as you do.
I have a file.edgelist of my graph and I don't understand how you can create a json file with edges and features.

Can you tell me how I can do it?

Thanks

RuntimeError: you must first build vocabulary before training the model

Hello! I was trying to use my own dataset, with the format that you give on the exmaple. But by running the code, i get the following error: "RuntimeError: you must first build vocabulary before training the model". Here I show a sample of the dataset.

{"edges": [[0, 16], [0, 14], [1, 2], [1, 2], [2, 1], [2, 16], [3, 4], [3, 2], [4, 8], [4, 3], [5, 1], [5, 17], [6, 7], [6, 11], [7, 11], [7, 6], [8, 4], [8, 11], [9, 12], [9, 13], [10, 13], [10, 9], [11, 7], [11, 8], [12, 9], [12, 13], [13, 10], [13, 12], [14, 16], [14, 0], [15, 0], [15, 14], [16, 0], [16, 0], [17, 15], [17, 0]], "features": {"0": 4, "1": 5, "2": 28, "3": 28, "4": 28, "5": 37, "6": 40, "7": 48, "8": 28, "9": 40, "10": 28, "11": 41, "12": 32, "13": 40, "14": 11, "15": 32, "16": 28, "17": 36, "18": 20, "19": 50, "20": 23, "21": 56, "22": 11, "23": 36, "24": 20, "25": 48, "26": 23, "27": 48, "28": 4, "29": 5, "30": 11, "31": 12, "32": 4, "33": 4, "34": 14, "35": 20}}

AttributeError: 'DegreeView' object has no attribute 'items'

Hey,
I got a issue when trying to use only a edge list as input. I attached one of my files.
The error is the following

python graph2vec/src/graph2vec.py --input-path graph_data/edge_lists/1/ --output-path nci2.csv

Feature extraction started.

100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 10/10 [00:01<00:00,  9.73it/s]
joblib.externals.loky.process_executor._RemoteTraceback: 
"""
Traceback (most recent call last):
  File "*/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 418, in _process_worker
    r = call_item()
  File "*/venv/lib/python3.8/site-packages/joblib/externals/loky/process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "*/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 608, in __call__
    return self.func(*args, **kwargs)
  File "*/venv/lib/python3.8/site-packages/joblib/parallel.py", line 255, in __call__
    return [func(*args, **kwargs)
  File "*/venv/lib/python3.8/site-packages/joblib/parallel.py", line 255, in <listcomp>
    return [func(*args, **kwargs)
  File "graph2vec/src/graph2vec.py", line 82, in feature_extractor
    graph, features, name = dataset_reader(path)
  File "graph2vec/src/graph2vec.py", line 72, in dataset_reader
    features = {int(k): v for k, v in features.items()}
AttributeError: 'DegreeView' object has no attribute 'items'
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "graph2vec/src/graph2vec.py", line 129, in <module>
    main(args)
  File "graph2vec/src/graph2vec.py", line 112, in main
    document_collections = Parallel(n_jobs=args.workers)(delayed(feature_extractor)(g, args.wl_iterations) for g in tqdm(graphs))
  File "*/venv/lib/python3.8/site-packages/joblib/parallel.py", line 1017, in __call__
    self.retrieve()
  File "*/venv/lib/python3.8/site-packages/joblib/parallel.py", line 909, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "*/venv/lib/python3.8/site-packages/joblib/_parallel_backends.py", line 562, in wrap_future_result
    return future.result(timeout=timeout)
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 439, in result
    return self.__get_result()
  File "/usr/local/lib/python3.8/concurrent/futures/_base.py", line 388, in __get_result
    raise self._exception
AttributeError: 'DegreeView' object has no attribute 'items'

I managed to solve it by editing the function dataset_reader:

def dataset_reader(path):
    """
    Function to read the graph and features from a json file.
    :param path: The path to the graph json.
    :return graph: The graph object.
    :return features: Features hash table.
    :return name: Name of the graph.
    """
    name = path.strip(".json").split("/")[-1]
    data = json.load(open(path))
    graph = nx.from_edgelist(data["edges"])

    if "features" in data.keys():
        features = data["features"]
        # moved the following line up because it wont work for the features derived by nx.degree()
        features = {int(k): v for k, v in features.items()}
    else:
        features = nx.degree(graph)
        # added this line features is a list of tuples
        features = {int(feature[0]): feature[1] for feature in features}
    return graph, features, name

I hope it does what the function was supposed to be.
I attached one of my files as example below.
805431435.zip

Different sized edge/feature lists

Hi, I am trying to implement graph2vec on a number of graphs with varying node/feature list lengths. Does this only operate on graphs with the same number of nodes? I tried removing some of the elements in the edge list for one of the sample .json files and this was the result:

Traceback (most recent call last):
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\externals\loky\process_executor.py", line 418, in _process_worker
    r = call_item()
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\externals\loky\process_executor.py", line 272, in __call__
    return self.fn(*self.args, **self.kwargs)
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\_parallel_backends.py", line 567, in __call__
    return self.func(*args, **kwargs)
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\parallel.py", line 225, in __call__
    for func, args, kwargs in self.items]
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\parallel.py", line 225, in <listcomp>
    for func, args, kwargs in self.items]
  File "src\graph2vec.py", line 83, in feature_extractor
    machine = WeisfeilerLehmanMachine(graph, features, rounds)
  File "src\graph2vec.py", line 29, in __init__
    self.do_recursions()
  File "src\graph2vec.py", line 53, in do_recursions
    self.features = self.do_a_recursion()
  File "src\graph2vec.py", line 39, in do_a_recursion
    degs = [self.features[neb] for neb in nebs]
  File "src\graph2vec.py", line 39, in <listcomp>
    degs = [self.features[neb] for neb in nebs]
KeyError: 20
"""
The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "src\graph2vec.py", line 130, in <module>
    main(args)
  File "src\graph2vec.py", line 113, in main
    document_collections = Parallel(n_jobs=args.workers)(delayed(feature_extractor)(g, args.wl_iterations) for g in tqdm(graphs))
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\parallel.py", line 930, in __call__
    self.retrieve()
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\parallel.py", line 833, in retrieve
    self._output.extend(job.get(timeout=self.timeout))
  File "\anaconda3\envs\g2vec\lib\site-packages\joblib\_parallel_backends.py", line 521, in wrap_future_result
    return future.result(timeout=timeout)
  File "\anaconda3\envs\g2vec\lib\concurrent\futures\_base.py", line 405, in result
    return self.__get_result()
  File "\anaconda3\envs\g2vec\lib\concurrent\futures\_base.py", line 357, in __get_result
    raise self._exception
KeyError: 20```

how to get the graph dataset?

Hi,
I have a molecular SMILES strings dataset, but I don't know how to transform this form of data into the graph dataset as mentioned in this repo. Any help would be appreciated.

graph encoding

What are the features? Can a node have more than one feature (string value)? Can edges have features? I am trying to encode semantic structures such as

http://delph-in.github.io/delphin-viz/demo/#input=I%20bought%20a%20book%20yesterday.&count=1&grammar=erg2018-uw&dmrs=true

Does it make sense? At a minimum, nodes have labels, edges have labels. Nodes can also have extra information attached to it (move the mouse over the nodes to see some examples). Can I encode that in graph2vec?

Explanation of params and how to extend to multiple node features

I am having a little trouble understanding the following.

  1. I don't quite get the intuition behind min_count parameter. How do I properly tune these two parameters, any insight on this would be very helpful.
  2. I'm also having a similar problem with the wl_iterations parameter. Any insight on this param would also be really helpful.
  3. Lastly, on a different issue you had mentioned that it's very easy to generalize the node features such that instead of it accepting only one node feature, it could take in multiple. But I'm having trouble implementing this. Pointers to this would also be really helpful!

error while running in windows

hello!
When I run "python src/graph2vec",there is some errors
1
And then I set breakpoints like this
2
And I found
f="./dataset\\0.json" and identifier="dataset\\0". That's why int(indentifier) is not correct.
I want to know what identifier should be if program run in a correct way(or in linux)

Variance in resulting embeddings

Hello!
I tried to calculate your embeddings for my own dataset of 300 graphs. The features are nide degrees as suggested in the paper, I only modified the number of epochs making it 40.
Let's say I now have embeddings 1, 2 and 3 of the same set of graphs (so graph2vec applied 3 times on the same data).
Then I tried to calculate map@5 for retrieval of the most similar embeddings between the embeddings 1 and 3, 1 and 2, 3 and 2. And I got really bad results, precisely map@5: 0.249222, 0.260222, 0.163278.
I got similar negative results using the dataset provided and default parameters.
Please, can you comment on that or let me know what I might be doing wrong?
Thank you!

graph2vec

We have used graph2vec to represent our sub-graphs as fixed length feature vectors for our project.

Using the default parameters, we entered 5 identical subgraphs (see below) but the features produced for the identical graphs (see attached csv file) are vastly different.

Also Kmeans clustering on the features above did not provide tightly clustered outputs for the identical subgraphs. Can you provide us with some insight as to what we may be doing wrong? We appreciate any suggestions you can provide.
i
Thank you so much
Input

0.json

{"edges": [[0, 1], [0, 2], [0, 3], [3, 4], [3, 5], [3, 2], [3, 1]], "features": {"0": "65", "1": "30", "2": "30", "3": "67", "4": "30", "5": "30"}}

1.json

{"edges": [[0, 1], [0, 2], [0, 3], [3, 4], [3, 5], [3, 2], [3, 1]], "features": {"0": "65", "1": "30", "2": "30", "3": "67", "4": "30", "5": "30"}}

2.json

{"edges": [[0, 1], [0, 2], [0, 3], [3, 4], [3, 5], [3, 2], [3, 1]], "features": {"0": "65", "1": "30", "2": "30", "3": "67", "4": "30", "5": "30"}}

3.json

{"edges": [[0, 1], [0, 2], [0, 3], [3, 4], [3, 5], [3, 2], [3, 1]], "features": {"0": "65", "1": "30", "2": "30", "3": "67", "4": "30", "5": "30"}}

4.json

{"edges": [[0, 1], [0, 2], [0, 3], [3, 4], [3, 5], [3, 2], [3, 1]], "features": {"0": "65", "1": "30", "2": "30", "3": "67", "4": "30", "5": "30"}}

features

type,x_0,x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8,x_9,x_10,x_11,x_12,x_13,x_14,x_15,x_16,x_17,x_18,x_19,x_20,x_21,x_22,x_23,x_24,x_25,x_26,x_27,x_28,x_29,x_30,x_31,x_32,x_33,x_34,x_35,x_36,x_37,x_38,x_39,x_40,x_41,x_42,x_43,x_44,x_45,x_46,x_47,x_48,x_49,x_50,x_51,x_52,x_53,x_54,x_55,x_56,x_57,x_58,x_59,x_60,x_61,x_62,x_63,x_64,x_65,x_66,x_67,x_68,x_69,x_70,x_71,x_72,x_73,x_74,x_75,x_76,x_77,x_78,x_79,x_80,x_81,x_82,x_83,x_84,x_85,x_86,x_87,x_88,x_89,x_90,x_91,x_92,x_93,x_94,x_95,x_96,x_97,x_98,x_99,x_100,x_101,x_102,x_103,x_104,x_105,x_106,x_107,x_108,x_109,x_110,x_111,x_112,x_113,x_114,x_115,x_116,x_117,x_118,x_119,x_120,x_121,x_122,x_123,x_124,x_125,x_126,x_127
0,-0.002921980805695057,0.0019917855970561504,0.00042243595817126334,-0.0001146442664321512,0.0027856503147631884,-0.003612641477957368,0.0007139553781598806,-0.002218850189819932,0.0007622303673997521,-0.003667013719677925,0.00020051038882229477,0.002386653795838356,-0.0015244260430335999,-0.001942446338944137,0.0015865900786593556,-0.002430693479254842,-1.423046433046693e-05,0.00043223355896770954,-0.0004984369734302163,0.0011258882004767656,-0.0006631789728999138,-0.001834464492276311,-0.002684623934328556,0.0021268008276820183,0.0016442902851849794,0.002274706494063139,0.0024222894571721554,0.0014194073155522346,0.0023438141215592623,0.0015838627004995942,0.002310663228854537,0.0014568573096767068,0.000690316257532686,0.0004983388935215771,-0.0026711630634963512,0.00340675818733871,0.002079088008031249,-0.0013625413412228227,0.0018945640185847878,0.0011790600838139653,0.003815916134044528,0.0034210982266813517,0.0037433707620948553,-0.0022726887837052345,-0.0026500080712139606,-0.0010492472210898995,0.0013163144467398524,-0.0001258519769180566,-0.0017091833287850022,0.003472822019830346,-0.0036862220149487257,0.003828400745987892,-0.0016809114022180438,0.0032152864150702953,-0.0008184377802535892,0.0034521056804805994,0.0032005112152546644,-0.0024409648030996323,0.0028309114277362823,0.002729770727455616,-0.003585312981158495,-0.00024177387240342796,-0.0002953226794488728,0.0005578010459430516,-0.0013301002327352762,-0.00023178242554422468,-0.0010268031619489193,-0.002611540723592043,0.0016747136833146214,0.0037863797042518854,-0.0014814079040661454,-0.0009825780289247632,0.000286577211227268,0.00369463162496686,0.0003661931841634214,-0.0036635601427406073,0.0038319083396345377,0.00034779138513840735,-0.0029241384472697973,-0.00015080621233209968,0.00245654652826488,0.0012698960490524769,0.0038113698828965425,0.0020659039728343487,-0.002460563788190484,0.003330332925543189,0.000335091317538172,0.0027111624367535114,-0.0021673559676855803,0.003040780546143651,0.0014197180280461907,0.0025863349437713623,-0.0008595485123805702,0.0016730247298255563,-0.002238348824903369,-0.0014983880100771785,-0.002856674138456583,0.003900788491591811,-0.0029116503428667784,0.0008353788871318102,-0.003707862226292491,-0.003220281330868602,0.0038748173974454403,-0.0012597186723724008,-0.0022263021674007177,0.0032723527401685715,0.001983931753784418,-0.0009860624559223652,-0.0026594484224915504,0.0005092752980999649,-0.0010045311646535993,0.00043074158020317554,-0.0006234926404431462,-0.0036853901110589504,0.0033234185539186,-0.0001760138402460143,0.0009347024606540799,0.0006853214581497014,-0.0009750690078362823,-0.001720305997878313,0.0033709295094013214,0.0024223600048571825,-0.001860664109699428,-0.0033350486773997545,5.440079985419288e-05,-0.0017850360600277781,0.0006075493292883039,0.0017705451464280486
1,-0.0007899366319179535,0.0034763035364449024,-0.0031649558804929256,-0.0038582677952945232,0.0030589941889047623,0.0024385270662605762,0.0007023548823781312,0.002542045433074236,0.003084726631641388,-0.0021342230029404163,0.002349107526242733,-0.0007615322829224169,-0.0033563957549631596,-0.001407726900652051,0.0017020516097545624,0.0008983929292298853,6.217532063601539e-05,-0.0019879427272826433,-0.0017635654658079147,-0.002506680553779006,-0.0027478302363306284,-0.001141324290074408,-0.00326850195415318,-0.0014613013481721282,-0.0017065171850845218,0.0011920499382540584,-0.0012276453198865056,0.0024964376352727413,0.0026812769938260317,-0.001462650136090815,0.0023853315506130457,-0.0022144729737192392,0.0016651339828968048,-0.0033012968488037586,-0.0017995499074459076,-0.0007093038293533027,-0.0007944940007291734,-0.0008988109766505659,-0.0006396020180545747,0.0036315470933914185,0.0031063579954206944,0.003404709044843912,-0.0034592982847243547,-0.0023505527060478926,0.0009349206811748445,0.0008606857154518366,-0.0034494020510464907,-0.0030351970344781876,0.0020507730077952147,-0.0034043036866933107,-0.0013356079580262303,0.0026185866445302963,-0.0003209983406122774,0.0010972495656460524,-0.003353237872943282,0.0005406123818829656,9.852329094428569e-05,0.0011593784438446164,-0.001968847122043371,-0.0034255434293299913,-0.0021584834903478622,0.0038824898656457663,-0.002288225805386901,-0.0021955370903015137,-0.0008158088312484324,-0.001036758767440915,-0.0030485547613352537,-0.0029740005265921354,0.00041252037044614553,0.0008094724034890532,-0.0013014365686103702,0.002923062304034829,0.0028244403656572104,0.0015162983909249306,0.0033367632422596216,-0.0024903069715946913,-0.0021822594571858644,-0.0003872658417094499,0.0014111202908679843,0.003218378871679306,0.00031110228155739605,-0.0031358294654637575,-0.0004674529191106558,-0.0006635853787884116,0.002574484795331955,4.1514329495839775e-05,-0.002413139445707202,-0.0034133922308683395,-8.862825779942796e-05,0.00010387676593381912,0.0013719667913392186,-0.0002543768205214292,0.0024005521554499865,-0.0018111238023266196,0.0009683762909844518,0.0032069890294224024,-0.0037442264147102833,-0.0023161424323916435,-0.0002594651887193322,0.001383508089929819,0.0036754277534782887,0.001844267826527357,-0.0038253869861364365,-0.0007103432435542345,-0.0018077954882755876,0.0030866663437336683,-8.397615602007136e-05,-0.0033143775071948767,-0.0012993044219911098,-0.0032517346553504467,0.002442749449983239,-0.0012355140643194318,0.0037098878528922796,0.0011372631415724754,-0.00047043408267199993,-0.0038157363887876272,-0.0017348530236631632,0.003638728056102991,0.001819252036511898,-0.00027891306672245264,0.0023341928608715534,0.000704775273334235,-0.001470968360081315,-0.0021361587569117546,-0.003107558935880661,0.0007341455202549696,0.0002843852271325886,0.0025384246837347746
2,-0.003191772848367691,0.0001835404837038368,-0.0011708770180121064,-0.0014271646505221725,0.0017692336114123464,0.0017457834910601377,0.002994104754179716,0.0028854620177298784,0.001106327516026795,-0.0017014361219480634,-0.002501782262697816,-0.003046308644115925,0.002076556906104088,0.0007232814095914364,0.003546368330717087,-0.0031842486932873726,-0.00012119952589273453,0.0027201976627111435,0.0035334290005266666,0.0007723849266767502,0.003673312021419406,0.00033438167884014547,-0.002535406267270446,-0.0035727310460060835,-0.0018347441218793392,-0.0006416176911443472,-0.0006869172211736441,-0.002686522202566266,0.0034463251940906048,0.000578683044295758,-0.0034865231718868017,-0.0035254214890301228,-0.0027820246759802103,0.0027613919228315353,0.0012621080968528986,-0.0025481393095105886,-0.0011443900875747204,0.00013140295050106943,0.0005833808099851012,0.0010550469160079956,-0.0019496568711474538,0.003822379047051072,0.0028459352906793356,-0.0032757942099124193,0.0025608153082430363,0.0030413619242608547,-0.0005989212077111006,-0.0028994232416152954,0.00025810833903960884,1.2741512364300434e-05,-0.0011288640089333057,0.003362147370353341,-0.0033266739919781685,-0.0017139799892902374,0.0008058756939135492,-0.0030933453235775232,-0.0032492964528501034,-0.0017976377857849002,0.0018832412315532565,-0.003904148004949093,0.001164337620139122,0.0038968115113675594,0.0030564262997359037,0.0002058401150861755,-0.002198415109887719,0.0032414819579571486,0.003652922809123993,0.0016236837254837155,0.0038159661926329136,0.0016936019528657198,-0.001772071816958487,-0.00010917303734458983,-0.0014565670862793922,0.002417120849713683,-0.0005687113152816892,-0.0034190653823316097,-0.0007575388299301267,-0.001252891612239182,-0.0027461089193820953,-0.0023173403460532427,-0.0029359806794673204,-0.002850216580554843,-0.0017987043829634786,-0.0008257846347987652,-0.0010036969324573874,0.0014453422045335174,0.00341025716625154,-0.0032494780607521534,0.0027634731959551573,0.0017919924575835466,0.0022179163061082363,0.0024956485722213984,-0.0036200007889419794,-0.003190566785633564,-0.0038656918331980705,0.002872048644348979,-0.000748040562029928,0.0018736685160547495,0.0032249221112579107,-5.06550975387654e-07,0.000869029900059104,0.00019358645658940077,0.0020771438721567392,0.0028800060972571373,-0.0009861814323812723,0.0011081903940066695,-0.0009238282218575478,-0.0023052829783409834,-0.0035225225146859884,0.00229478906840086,0.0031650331802666187,-0.0007591700414195657,-0.0024068383499979973,-0.0011479462264105678,0.0004679410776589066,-0.000213331775739789,-0.002047076588496566,0.0023680971935391426,-0.0008420454687438905,0.0018676763866096735,-0.0028614168986678123,-0.002850909484550357,0.00029416586039587855,-0.0005077925743535161,-0.00020983308786526322,0.002263167407363653,0.001448919763788581,-0.002695369767025113
3,0.00226890342310071,0.0004349398659542203,0.002644110703840852,0.001253339578397572,8.279987923742738e-06,-0.001131041324697435,-0.00016871494881343096,0.0037425034679472446,-0.0004944991669617593,0.002063847379758954,0.0016815878916531801,0.001273772562853992,0.0002401862875558436,0.0005198025610297918,-0.002226941753178835,-0.0036225663498044014,-0.001742878113873303,-0.0021801230031996965,-0.0013626416912302375,0.0028272985946387053,-0.00212662061676383,0.000749408733099699,0.002696521580219269,-0.0001593382767168805,0.003844756865873933,-0.0003320556425023824,0.0022467942908406258,-0.0004261289141140878,0.00248247804120183,-0.0006328768795356154,0.0022790112998336554,0.0008149463101290166,-0.0001626605517230928,-0.002950516762211919,0.002453156979754567,-0.00021675876632798463,0.00034372464870102704,0.0004411549598444253,0.0023702923208475113,0.0001581401302246377,-7.819894562999252e-06,-0.003531169844791293,-0.003829261288046837,-0.0020093373022973537,-0.001471416442655027,-0.000981805962510407,-0.003142383648082614,0.0007026693201623857,-0.002985609695315361,0.0016819903394207358,-0.0034136781468987465,0.0023745307698845863,0.003282897174358368,0.0034192968159914017,0.0018797536613419652,0.0031688385643064976,0.003438518615439534,-0.0013528221752494574,-0.0014454845804721117,-0.0003827727632597089,-0.0033089127391576767,-0.0007924533565528691,-0.0027770015876740217,-0.0031972306314855814,-0.0018739199731498957,0.0017090975306928158,0.001514140865765512,0.0014564525336027145,-0.0010264359880238771,0.0008885915740393102,0.0016617580549791455,-0.0020448844879865646,0.001694984151981771,0.003790121991187334,-2.4743640096858144e-05,6.94061818649061e-05,-0.0027131030801683664,0.0032475837506353855,-0.0034968117251992226,-0.00022669867030344903,-0.0009578681201674044,0.003755686804652214,0.0009502334869466722,-0.001079508918337524,0.0006866870098747313,-0.0010925616370514035,0.0007450280827470124,0.0007697222172282636,0.0005540053825825453,-0.0027229939587414265,-0.0013332952512428164,0.003556907642632723,0.0016613180050626397,-0.002592679113149643,-0.0011174503015354276,-0.0005371844163164496,-0.0006635829340666533,0.0006453921087086201,-8.852890459820628e-05,-0.0033397218212485313,0.0005219417507760227,-0.001324216602370143,0.0024543653707951307,-0.0019174609333276749,-3.89934066333808e-05,0.0010165907442569733,-0.003580202581360936,0.0033339345827698708,0.0022478068713098764,-0.0020412227604538202,-0.000650318805128336,0.0029213305097073317,0.002677810611203313,-0.002436918905004859,-0.0012986373621970415,-0.00012114057608414441,0.0016735560493543744,0.0024930897634476423,-0.0013271743664517999,0.0001399534085066989,8.283466013381258e-05,0.003352649509906769,-0.0014204017352312803,0.002870027907192707,0.0021030264906585217,0.0011896740179508924,-0.003351186867803335,-0.0006756282527931035
4,0.0019581944216042757,-0.0022107346449047327,-0.0011561198625713587,-0.002886272268369794,0.001594733214005828,-0.001594776171259582,0.0026919764932245016,-0.00012680278450716287,-0.0005581804434768856,-0.0035449275746941566,0.0037003939505666494,0.0012354212813079357,-0.0009580010082572699,0.00014428250142373145,-0.0014593577943742275,-0.002729069208726287,0.0005723288049921393,0.0035142232663929462,0.003921943251043558,-0.003527914872393012,0.0019456726731732488,0.0022559280041605234,-0.0005423698457889259,0.001034521614201367,-0.0013501851353794336,0.0027604158967733383,-0.002807273529469967,0.00024234205193351954,-0.0016576320631429553,-0.0012966239592060447,-0.002213762840256095,-0.003365762997418642,-0.0006228607380762696,-0.002895353827625513,-0.0035488856956362724,0.0013820005115121603,-0.0009534824639558792,0.0018478281563147902,0.0034116727765649557,-0.0006756664952263236,0.0024415014777332544,-0.0029353690333664417,-0.0025126056279987097,-0.0009988313540816307,0.0036377261858433485,0.002995045855641365,-0.0019054751610383391,0.0029589999467134476,0.0008932192577049136,-0.0013001038460060954,-0.0020715310238301754,-0.00020094586943741888,0.002570840297266841,0.00380155723541975,-0.002473586704581976,0.0011213001562282443,0.0031946205999702215,9.909242362482473e-05,0.001311403582803905,0.002204875461757183,-0.0011220034211874008,0.0016122518572956324,0.002348880050703883,0.0035365682560950518,0.000909817055799067,0.002755098743364215,-0.003383677452802658,0.0009969278471544385,0.00048190669622272253,-0.0015868479385972023,0.0004751212545670569,-0.0006727377185598016,0.0024358814116567373,-0.0016325784381479025,7.368947990471497e-05,0.0021812072955071926,8.241814066423103e-05,-0.0024973764084279537,0.002266516676172614,0.0037054966669529676,0.0005226759240031242,0.00389161822386086,0.001365591655485332,-0.0012526890495792031,-0.0006436291732825339,0.0026691495440900326,0.0006279962253756821,-0.00046710699098184705,-0.003736028913408518,-0.0007733455277048051,-0.0025140242651104927,-0.0011113928630948067,0.000681806995999068,-0.0023756904993206263,0.0032400900963693857,0.0034952759742736816,4.563291804515757e-05,0.003599037416279316,-0.0007084793760441244,0.0026228672359138727,0.0018671357538551092,0.00361993839032948,-0.0032833567820489407,0.0009056946146301925,0.002505404641851783,0.0018368527526035905,0.0023507531732320786,-0.0016589193837717175,-0.0010653110221028328,-0.0034096611198037863,0.0037409814540296793,-0.0033911853097379208,-0.0016950403805822134,0.0009163717622868717,0.0020247497595846653,0.0028596229385584593,-0.00021874137746635824,-0.00133735709823668,0.0036610793322324753,0.0022860660683363676,-0.0016334510874003172,-0.003308979794383049,-0.003778632963076234,0.0006930023082531989,0.0002600970910862088,0.003300223732367158,-0.0016991931479424238,0.000940822996199131

Can I use multiple features of a particular node?

For example, in the example dataset, the features in the graph looks like this, {"features": {"0": "1", "1": "1", "2": "1", "3": "1"}.
If node 0 has multiple features, can I use those in a list? For example, as follows...
{"features": {"0": [1,0.1, 3, 5, 1.2], "1": [0.7, 0.8], "2": "1", "3": "1"}.

I tweaked the graph data like this but didn't notice any change in the graph encoding. Can you please help me how can I use multiple features of nodes during the embedding?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.