cugraph.experimental.PropertyGraph.get_vertex_data#
- PropertyGraph.get_vertex_data(vertex_ids=None, types=None, columns=None)[source]#
Gets a DataFrame containing vertex properties
- Parameters:
- vertex_idsone or a collection of integers, optional
single, list, slice, pandas array, or series of integers which are the vertices to include in the returned dataframe
- typesstr or collection of str, optional
types of the vertices to include in the returned data. Default is to return all vertex types.
- columnsstr or list of str, optional
property or properties to include in returned data. Default includes all properties.
- Returns:
- DataFrame
containing vertex properties for only the specified vertex_ids, columns, and/or types, or all vertex IDs if not specified.
Examples
>>> import cugraph >>> import cudf >>> from cugraph.experimental import PropertyGraph >>> df = cudf.DataFrame(columns=["src", "dst", "some_property"], ... data=[(99, 22, "a"), ... (98, 34, "b"), ... (97, 56, "c"), ... (96, 88, "d"), ... ]) >>> pG = PropertyGraph() >>> pG.add_edge_data(df, type_name="etype", vertex_col_names=("src", "dst")) >>> vert_df = cudf.DataFrame({"vert_id": [99, 22, 98, 34, 97, 56, 96, 88], ... "v_prop": [1, 2, 3, 4, 5, 6, 7, 8]}) >>> pG.add_vertex_data(vert_df, type_name="vtype", vertex_col_name="vert_id") >>> pG.get_vertex_data().sort_index(axis=1) _TYPE_ _VERTEX_ v_prop 0 vtype 99 1 1 vtype 22 2 2 vtype 98 3 3 vtype 34 4 4 vtype 97 5 5 vtype 56 6 6 vtype 96 7 7 vtype 88 8