用法:
cugraph.structure.convert_matrix.from_pandas_edgelist(df, source='source', destination='destination', edge_attr=None, create_using=<class 'cugraph.structure.graph_classes.Graph'>, renumber=True)
從邊列表初始化一個圖。在已初始化的 Graph 對象上調用此方法是錯誤的。源參數是源列名,目標參數是目標列名。
默認情況下,啟用重新編號以將源頂點和目標頂點映射到 [0, V) 範圍內的索引,其中 V 是頂點數。如果輸入頂點是 [0, V) 範圍內的單列整數,則可以禁用重新編號,並且將使用原始的外部頂點 ID。
如果存在權重,edge_attr 參數是權重列名稱。
- df:pandas.DataFrame
包含邊信息的 DataFrame
- source:str 或array-like,可選(默認='source')
源列名或列名數組
- destination:str 或array-like,可選(默認='destination')
目標列名或列名數組
- edge_attr:str 或無,可選(默認=無)
權重列名稱。
- renumber:布爾,可選(默認=真)
指示是否對源頂點 ID 和目標頂點 ID 重新編號。
- create_using: cugraph.DiGraph or cugraph.Graph, optional (default=Graph):
指示是創建有向圖還是無向圖
- G:cugraph.DiGraph 或 cugraph.Graph
包含來自 pandas 邊列表的邊的圖
參數:
返回:
例子:
>>> # Download dataset from >>> # https://github.com/rapidsai/cugraph/datasets/... >>> df = pd.read_csv(datasets_path / 'karate.csv', delimiter=' ', ... header=None, names=["0", "1", "2"], ... dtype={"0": "int32", "1": "int32", "2": "float32"}) >>> G = cugraph.Graph() >>> G.from_pandas_edgelist(df, source='0', destination='1', ... edge_attr='2', renumber=False)
相關用法
- Python cugraph.structure.convert_matrix.from_edgelist用法及代碼示例
- Python cugraph.structure.convert_matrix.from_adjlist用法及代碼示例
- Python cugraph.structure.convert_matrix.from_cudf_edgelist用法及代碼示例
- Python cugraph.structure.symmetrize.symmetrize_df用法及代碼示例
- Python cugraph.structure.symmetrize.symmetrize_ddf用法及代碼示例
- Python cugraph.structure.symmetrize.symmetrize用法及代碼示例
- Python cugraph.sampling.random_walks.random_walks用法及代碼示例
- 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.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.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用法及代碼示例
注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cugraph.structure.convert_matrix.from_pandas_edgelist。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。