Skip to content

Fastest python node2vec embeddings in the west

License

Notifications You must be signed in to change notification settings

healx/graph2vec

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quick Example:

    import networkx as nx
    from graph2vec import Node2Vec

    # Test Graph
    G = nx.generators.classic.wheel_graph(100)
 
    # Fit embedding model to graph
    g2v = Node2Vec()
    g2v.fit(G) # way faster than other node2vec implementations
 
    # query embeddings for node 42
    g2v.predict(42)

    # Save model to gensim.KeyedVector format
    g2v.save("wheel_model.bin")
    
    # load in gensim
    from gensim.models import KeyedVectors
    model = KeyedVectors.load_word2vec_format("wheel_model.bin")
    model[str(43)] # need to make nodeID a str for gensim
    

Installing

Currently through downloading this project and python setup.py install. I'll get it on pip ASAP.

Test Installation (from project's root folder)

python -m unittest discover tests

About

Fastest python node2vec embeddings in the west

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%