PersonalizedPageRankMachine¶
- class PersonalizedPageRankMachine(host, graphname, username, secret, password)[source]¶
Bases:
object
Define a drug-protein graph and compute the Personalized PageRank of nodes.
Methods Summary
connect
()Connect to the host with the authentication details.
get_personalized_pagerank
(node_ids[, …])Compute the pruned Personalized PageRank for a list of nodes.
install_query
([url])Install a query on the host.
personalized_pagerank
(node_id[, node_type, …])Compute the pagerank for a specific node.
upload_graph
(new_graph, edges)Uploadthe edges from a dataframe using the PyTigerGraph connection.
Methods Documentation
- get_personalized_pagerank(node_ids, edge_type='interacts', print_accum=True, damping=0.5, iterations=100, top_k=100)[source]¶
Compute the pruned Personalized PageRank for a list of nodes.
- Parameters
- Return type
DataFrame
- Returns
A table of node pairs with PageRank scores.
- install_query(url='https://raw.githubusercontent.com/tigergraph/gsql-graph-algorithms/master/algorithms/Centrality/pagerank/personalized/multi_source/tg_pagerank_pers.gsql')[source]¶
Install a query on the host.
- Parameters
url (
str
) – A url to the query string.
- personalized_pagerank(node_id, node_type='drug', edge_type='interacts', print_accum=True, damping=0.85, iterations=20, top_k=40)[source]¶
Compute the pagerank for a specific node.
- Parameters
node_id – Identifier of the node of interest.
node_type – Type of the node.
edge_type – Type of the edge.
print_accum – Accumulation flag.
damping – Non return probability.
iterations – Number of steps per walk.
top_k – Number of closest neighbors to return for the query.
- Returns
Personalized PageRank nodes for a specific node in the Graph.