用法:
cugraph.link_prediction.woverlap.overlap_w(input_graph, weights, vertex_pair=None)
計算由邊連接的每對頂點之間或用戶指定的任意頂點對之間的加權重疊係數。重疊係數定義為兩組之間的交集體積除以它們中較小的體積的比率。在圖的上下文中,頂點的鄰域被視為一個集合。每條邊的重疊係數權重表示基於相鄰頂點的相對相似性的頂點之間的連接強度。如果指定了第一個但沒有指定第二個,反之亦然,將拋出異常。
- input_graph:cugraph.Graph
cuGraph 圖形實例,應包含作為邊列表的連接信息(此算法不使用邊權重)。如果不存在鄰接列表,則將計算該鄰接列表。
- weights:cudf.DataFrame
指定要用於每個頂點的權重。頂點應由multi-column 頂點的多列表示。
- 權重[‘vertex’]:cudf.Series
包含頂點標識符
- 權重[‘weight’]:cudf.Series
包含頂點的權重
- vertex_pair:cudf.DataFrame,可選(默認=無)
一個 GPU 數據幀,由代表頂點對的兩列組成。如果提供,則為給定的頂點對計算重疊係數,否則,為所有頂點對計算重疊係數。
- df:cudf.DataFrame
大小為 E(默認)的 GPU 數據幀或包含重疊係數的給定對(第一、第二)的大小。排序是相對於鄰接列表的,或者是由指定的頂點對給出的。
- df[‘source’]:cudf.Series
源頂點 ID
- df[‘destination’]:cudf.Series
目標頂點 ID
- df[‘overlap_coeff’]:cudf.Series
計算的源頂點和目標頂點之間的加權重疊係數。
參數:
返回:
例子:
>>> import random >>> M = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... dtype=['int32', 'int32', 'float32'], header=None) >>> G = cugraph.Graph() >>> G.from_cudf_edgelist(M, source='0', destination='1') >>> # Create a dataframe containing the vertices with their >>> # corresponding weight >>> weights = cudf.DataFrame() >>> # Sample 10 random vertices from the graph and drop duplicates if >>> # there are any to avoid duplicates vertices with different weight >>> # value in the 'weights' dataframe >>> weights['vertex'] = G.nodes().sample(n=10).drop_duplicates() >>> # Reset the indices and drop the index column >>> weights.reset_index(inplace=True, drop=True) >>> # Create a weight column with random weights >>> weights['weight'] = [random.random() for w in range( ... len(weights['vertex']))] >>> df = cugraph.overlap_w(G, weights)
相關用法
- Python cugraph.link_prediction.wjaccard.jaccard_w用法及代碼示例
- Python cugraph.link_prediction.jaccard.jaccard用法及代碼示例
- Python cugraph.link_prediction.overlap.overlap用法及代碼示例
- Python cugraph.link_prediction.jaccard.jaccard_coefficient用法及代碼示例
- Python cugraph.link_analysis.pagerank.pagerank用法及代碼示例
- Python cugraph.link_analysis.hits.hits用法及代碼示例
- Python cugraph.linear_assignment.hungarian用法及代碼示例
- Python cugraph.community.spectral_clustering.spectralBalancedCutClustering用法及代碼示例
- Python cugraph.community.ecg.ecg用法及代碼示例
- Python cugraph.Graph.from_cudf_adjlist用法及代碼示例
- Python cugraph.community.louvain.louvain用法及代碼示例
- Python cugraph.tree.minimum_spanning_tree.maximum_spanning_tree用法及代碼示例
- Python cugraph.centrality.betweenness_centrality.betweenness_centrality用法及代碼示例
- Python cugraph.dask.community.louvain.louvain用法及代碼示例
- Python cugraph.traversal.bfs.bfs用法及代碼示例
- Python cugraph.community.egonet.batched_ego_graphs用法及代碼示例
- Python cugraph.tree.minimum_spanning_tree.minimum_spanning_tree用法及代碼示例
- Python cugraph.Graph.from_cudf_edgelist用法及代碼示例
- Python cugraph.centrality.betweenness_centrality.edge_betweenness_centrality用法及代碼示例
- Python cugraph.components.connectivity.strongly_connected_components用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cugraph.link_prediction.woverlap.overlap_w。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。