Graph Classes#

Constructors#

Graph([m_graph, directed])

A GPU Graph Object (Base class of other graph types)

MultiGraph([directed])

A Multigraph; a Graph containing more than one edge between vertex pairs.

Adding Data#

Graph.from_cudf_adjlist(offset_col, index_col)

Initialize a graph from the adjacency list.

Graph.from_cudf_edgelist(input_df[, source, ...])

Initialize a graph from the edge list.

Graph.from_dask_cudf_edgelist(input_ddf[, ...])

Initializes the distributed graph from the dask_cudf.DataFrame edgelist.

Graph.from_pandas_adjacency(pdf)

Initializes the graph from pandas adjacency matrix.

Graph.from_pandas_edgelist(pdf[, source, ...])

Initialize a graph from the edge list.

Graph.from_numpy_array(np_array[, nodes])

Initializes the graph from numpy array containing adjacency matrix.

Graph.from_numpy_matrix(np_matrix)

Initializes the graph from numpy matrix containing adjacency matrix.

Graph.add_internal_vertex_id(df, ...[, ...])

Given a DataFrame containing external vertex ids in the identified columns, return a DataFrame containing the internal vertex ids as the specified column name.

Graph.add_nodes_from(nodes)

Add nodes information to the Graph.

Graph.clear()

Empty the graph.

Graph.unrenumber(df, column_name[, ...])

Given a DataFrame containing internal vertex ids in the identified column, replace this with external vertex ids.

Checks#

Graph.has_isolated_vertices()

Returns True if the graph has isolated vertices.

Graph.is_bipartite()

Checks if Graph is bipartite.

Graph.is_directed()

Returns True if the graph is a directed graph.

Graph.is_multigraph()

Returns True if the graph is a multigraph.

Graph.is_multipartite()

Checks if Graph is multipartite.

Graph.is_renumbered()

Returns True if the graph is renumbered.

Graph.is_weighted()

Returns True if the graph has edge weights.

Graph.lookup_internal_vertex_id(df[, ...])

Given a DataFrame containing external vertex ids in the identified columns, or a Series containing external vertex ids, return a Series with the internal vertex ids.

Graph.to_directed()

Return a directed representation of the graph.

Graph.to_undirected()

Return an undirected copy of the graph.

Symmetrize#

cugraph.symmetrize(input_df, ...[, ...])

Take a dataframe of source destination pairs along with associated values stored in a single GPU or distributed create a COO set of source destination pairs along with values where all edges exist in both directions.

cugraph.symmetrize_ddf(ddf, src_name, dst_name)

Take a COO stored in a distributed DataFrame, and the column names of the source and destination columns and create a new data frame using the same column names that symmetrize the graph so that all edges appear in both directions.

cugraph.symmetrize_df(df, src_name, dst_name)

Take a COO stored in a DataFrame, along with the column names of the source and destination columns and create a new data frame using the same column names that symmetrize the graph so that all edges appear in both directions.

Conversion from Other Formats#

cugraph.from_adjlist(offsets, indices[, ...])

Initializes the graph from cuDF or Pandas Series representing adjacency matrix CSR data and returns a new cugraph.Graph object.

cugraph.from_cudf_edgelist(df[, source, ...])

Return a new graph created from the edge list representaion.

cugraph.from_edgelist(df[, source, ...])

Return a new graph created from the edge list representaion.

cugraph.from_numpy_array(A[, create_using])

Initializes the graph from numpy array containing adjacency matrix.

cugraph.from_numpy_matrix(A[, create_using])

Initializes the graph from numpy matrix containing adjacency matrix.

cugraph.from_pandas_adjacency(df[, create_using])

Initializes the graph from pandas adjacency matrix.

cugraph.from_pandas_edgelist(df[, source, ...])

Initialize a graph from the edge list.

cugraph.to_numpy_array(G)

Returns the graph adjacency matrix as a NumPy array.

cugraph.to_numpy_matrix(G)

Returns the graph adjacency matrix as a NumPy matrix.

cugraph.to_pandas_adjacency(G)

Returns the graph adjacency matrix as a Pandas DataFrame.

cugraph.to_pandas_edgelist(G[, source, ...])

Returns the graph edge list as a Pandas DataFrame.

NumberMap#

cugraph.structure.NumberMap([...])

Methods

cugraph.structure.NumberMap.from_internal_vertex_id(df)

Given a collection of internal vertex ids, return a DataFrame of the external vertex ids

cugraph.structure.NumberMap.to_internal_vertex_id(df)

Given a collection of external vertex ids, return the internal vertex ids

cugraph.structure.NumberMap.add_internal_vertex_id(df)

Given a collection of external vertex ids, return the internal vertex ids combined with the input data.

cugraph.structure.NumberMap.compute_vals(...)

Helper function to compute internal column names based on external column names

cugraph.structure.NumberMap.compute_vals_types(df, ...)

Helper function to compute internal column names and types

cugraph.structure.NumberMap.generate_unused_column_name(...)

Helper function to generate an unused column name

cugraph.structure.NumberMap.renumber(df, ...)

cugraph.structure.NumberMap.renumber_and_segment(df, ...)

Given an input dataframe with its column names, this function returns the renumbered dataframe(if renumbering occured) along with a mapping from internal to external vertex IDs.

cugraph.structure.NumberMap.set_renumbered_col_names(...)

Sets self.renumbered_src_col_name and self.renumbered_dst_col_name to values that can be used to replace src_col_names_to_replace and dst_col_names_to_replace to values that will not collide with any other column names in all_col_names.

cugraph.structure.NumberMap.unrenumber(df, ...)

Given a DataFrame containing internal vertex ids in the identified column, replace this with external vertex ids.

cugraph.structure.NumberMap.vertex_column_size()

Other#

cugraph.hypergraph(values[, columns, ...])

Creates a hypergraph out of the given dataframe, returning the graph components as dataframes.