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.
Initializes the graph from pandas adjacency matrix.
from_pandas_edgelist
(pdf[, source, ...])Initialize a graph from the edge list.
Returns True if the graph has isolated vertices.
Checks if Graph is bipartite.
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.
Returns True if the graph is a multigraph.
Checks if Graph is multipartite.
is_remote
()Returns True if the graph is remote; otherwise returns False.
Returns True if the graph is renumbered.
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.
Return a directed representation of the graph.
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
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.
Initializes the graph from pandas adjacency matrix.
from_pandas_edgelist
(pdf[, source, ...])Initialize a graph from the edge list.
Returns True if the graph has isolated vertices.
Checks if Graph is bipartite.
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.
Returns True if the graph is a multigraph.
Checks if Graph is multipartite.
is_remote
()Returns True if the graph is remote; otherwise returns False.
Returns True if the graph is renumbered.
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.
Return a directed representation of the graph.
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.