mowl.walking
Walking
- class mowl.walking.walking.WalkingModel(num_walks, walk_length, outfile, workers=1)[source]
Bases:
object
- Parameters
- walk(edges, nodes_of_interest=None)[source]
This method will generate random walks from a graph in the form of edgelist.
- Parameters
edges (
mowl.projection.edge.Edge
) – List of edgesnodes_of_interest (list, optional) – List of entity names to filter the generated walks. If a walk contains at least one word of interest, it will be saved into disk, otherwise it will be ignored. If no list is input, all the nodes will be considered. Defaults to
None
Changed in version 0.1.0: The method now can accept a list of entities to focus on when generating the random walks.
DeepWalk
- class mowl.walking.deepwalk.model.DeepWalk(num_walks, walk_length, alpha=0.0, outfile=None, workers=1, seed=0)[source]
Bases:
WalkingModel
Implementation of DeepWalk based on <https://github.com/phanein/deepwalk/blob/master/deepwalk/graph.py>
- Parameters
alpha (float, optional) – Probability of restart, defaults to 0
Node2Vec
- class mowl.walking.node2vec.model.Node2Vec(num_walks, walk_length, p=1, q=1, outfile=None, workers=1)[source]
Bases:
WalkingModel
- Parameters
- walk(edges, nodes_of_interest=None)[source]
This method will generate random walks from a graph in the form of edgelist.
- Parameters
edges (
mowl.projection.edge.Edge
) – List of edgesnodes_of_interest (list, optional) – List of entity names to filter the generated walks. If a walk contains at least one word of interest, it will be saved into disk, otherwise it will be ignored. If no list is input, all the nodes will be considered. Defaults to
None
Changed in version 0.1.0: The method now can accept a list of entities to focus on when generating the random walks.