cugraph.Graph#

class cugraph.Graph(m_graph=None, directed=False)[source]#

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

Parameters:
m_graphcuGraph.MultiGraph object or None (default=None)

Initialize the graph from a cugraph.MultiGraph object

directedboolean, optional (default=False)

Indicated is the graph is directed.

Examples

>>> # undirected graph
>>> G = cugraph.Graph()
>>> # directed graph
>>> G = cugraph.Graph(directed=True)

Methods

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

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

add_nodes_from(nodes)

Add nodes information to the Graph.

clear()

Empty the graph.

density()

Compute the density of the graph.

from_cudf_adjlist(offset_col, index_col[, ...])

Initialize a graph from the adjacency list.

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

Initialize a graph from the edge list.

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

Initializes the distributed graph from the dask_cudf.DataFrame edgelist.

from_numpy_array(np_array[, nodes])

Initializes the graph from numpy array containing adjacency matrix.

from_numpy_matrix(np_matrix)

Initializes the graph from numpy matrix containing adjacency matrix.

from_pandas_adjacency(pdf)

Initializes the graph from pandas adjacency matrix.

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

Initialize a graph from the edge list.

has_isolated_vertices()

Returns True if the graph has isolated vertices.

is_bipartite()

Checks if Graph is bipartite.

is_directed()

Returns True if the graph is a directed graph.

is_multi_gpu()

Returns True if the graph is a multi-gpu graph; otherwise returns False.

is_multigraph()

Returns True if the graph is a multigraph.

is_multipartite()

Checks if Graph is multipartite.

is_remote()

Returns True if the graph is remote; otherwise returns False.

is_renumbered()

Returns True if the graph is renumbered.

is_weighted()

Returns True if the graph has edge weights.

lookup_internal_vertex_id(df[, column_name])

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.

to_directed()

Return a directed representation of the graph.

to_undirected()

Return an undirected copy of the graph.

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

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

Properties

__init__(m_graph=None, directed=False)[source]#

Methods

__init__([m_graph, directed])

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

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

add_nodes_from(nodes)

Add nodes information to the Graph.

clear()

Empty the graph.

density()

Compute the density of the graph.

from_cudf_adjlist(offset_col, index_col[, ...])

Initialize a graph from the adjacency list.

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

Initialize a graph from the edge list.

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

Initializes the distributed graph from the dask_cudf.DataFrame edgelist.

from_numpy_array(np_array[, nodes])

Initializes the graph from numpy array containing adjacency matrix.

from_numpy_matrix(np_matrix)

Initializes the graph from numpy matrix containing adjacency matrix.

from_pandas_adjacency(pdf)

Initializes the graph from pandas adjacency matrix.

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

Initialize a graph from the edge list.

has_isolated_vertices()

Returns True if the graph has isolated vertices.

is_bipartite()

Checks if Graph is bipartite.

is_directed()

Returns True if the graph is a directed graph.

is_multi_gpu()

Returns True if the graph is a multi-gpu graph; otherwise returns False.

is_multigraph()

Returns True if the graph is a multigraph.

is_multipartite()

Checks if Graph is multipartite.

is_remote()

Returns True if the graph is remote; otherwise returns False.

is_renumbered()

Returns True if the graph is renumbered.

is_weighted()

Returns True if the graph has edge weights.

lookup_internal_vertex_id(df[, column_name])

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.

to_directed()

Return a directed representation of the graph.

to_undirected()

Return an undirected copy of the graph.

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

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