用法:
Graph.from_cudf_adjlist(offset_col, index_col, value_col=None)
從鄰接列表初始化一個圖。在已初始化的 Graph 對象上調用此方法是錯誤的。傳遞的 offset_col 和 index_col 參數包裝了 gdf_column 對象,這些對象表示使用鄰接表格式的圖形。如果value_col 為無,則創建未加權圖。如果value_col 不是無,則創建加權圖。無向邊必須在兩個方向上存儲為有向邊。
- offset_col:cudf.Series
這個 cudf.Series 包裝了一個大小為 V + 1(V:頂點數)的 gdf_column。 gdf 列包含此圖中頂點的偏移量。偏移量必須在 [0, E] 範圍內(E:邊數)
- index_col:cudf.Series
這個 cudf.Series 包裝了大小為 E 的 gdf_column(E:邊數)。 gdf 列包含每條邊的目標索引。目標索引必須在 [0, V) 範圍內(V:頂點數)。
- value_col:cudf.Series,可選(默認=無)
該指針可以是
None
。如果不是,則此 cudf.Series 包裝大小為 E(E:邊數)的 gdf_column。 gdf 列包含每條邊的權重值。 gdf_column 元素的預期類型是浮點數。
參數:
例子:
>>> gdf = cudf.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... dtype=['int32', 'int32', 'float32'], ... header=None) >>> M = gdf.to_pandas() >>> M = scipy.sparse.coo_matrix((M['2'],(M['0'],M['1']))) >>> M = M.tocsr() >>> offsets = cudf.Series(M.indptr) >>> indices = cudf.Series(M.indices) >>> G = cugraph.Graph() >>> G.from_cudf_adjlist(offsets, indices, None)
相關用法
- Python cugraph.Graph.from_cudf_edgelist用法及代碼示例
- Python cugraph.Graph.from_pandas_edgelist用法及代碼示例
- Python cugraph.Graph.to_directed用法及代碼示例
- Python cugraph.Graph.to_undirected用法及代碼示例
- Python cugraph.Graph用法及代碼示例
- Python cugraph.community.spectral_clustering.spectralBalancedCutClustering用法及代碼示例
- Python cugraph.link_prediction.jaccard.jaccard用法及代碼示例
- Python cugraph.link_prediction.wjaccard.jaccard_w用法及代碼示例
- Python cugraph.community.ecg.ecg用法及代碼示例
- Python cugraph.community.louvain.louvain用法及代碼示例
- Python cugraph.tree.minimum_spanning_tree.maximum_spanning_tree用法及代碼示例
- Python cugraph.centrality.betweenness_centrality.betweenness_centrality用法及代碼示例
- Python cugraph.link_analysis.pagerank.pagerank用法及代碼示例
- 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.centrality.betweenness_centrality.edge_betweenness_centrality用法及代碼示例
- Python cugraph.link_prediction.woverlap.overlap_w用法及代碼示例
- Python cugraph.link_prediction.overlap.overlap用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cugraph.Graph.from_cudf_adjlist。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。