cugraph.dask.centrality.eigenvector_centrality.eigenvector_centrality#

cugraph.dask.centrality.eigenvector_centrality.eigenvector_centrality(input_graph, max_iter=100, tol=1e-06)[source]#

Compute the eigenvector centrality for a graph G.

Eigenvector centrality computes the centrality for a node based on the centrality of its neighbors. The eigenvector centrality for node i is the i-th element of the vector x defined by the eigenvector equation.

Parameters:
input_graphcuGraph.Graph or networkx.Graph

cuGraph graph descriptor with connectivity information. The graph can contain either directed or undirected edges.

max_iterint, optional (default=100)

The maximum number of iterations before an answer is returned. This can be used to limit the execution time and do an early exit before the solver reaches the convergence tolerance.

tolfloat, optional (default=1e-6)

Set the tolerance the approximation, this parameter should be a small magnitude value. The lower the tolerance the better the approximation. If this value is 0.0f, cuGraph will use the default value which is 1.0e-6. Setting too small a tolerance can lead to non-convergence due to numerical roundoff. Usually values between 1e-2 and 1e-6 are acceptable.

normalizednot supported

If True normalize the resulting eigenvector centrality values

Returns:
dfdask_cudf.DataFrame

GPU data frame containing two cudf.Series of size V: the vertex identifiers and the corresponding eigenvector centrality values.

df[‘vertex’]cudf.Series

Contains the vertex identifiers

df[‘eigenvector_centrality’]cudf.Series

Contains the eigenvector centrality of vertices

Examples

>>> import cugraph.dask as dcg
>>> import dask_cudf
>>> # ... Init a DASK Cluster
>>> #    see https://docs.rapids.ai/api/cugraph/stable/dask-cugraph.html
>>> # Download dataset from https://github.com/rapidsai/cugraph/datasets/..
>>> chunksize = dcg.get_chunksize(datasets_path / "karate.csv")
>>> ddf = dask_cudf.read_csv(datasets_path / "karate.csv",
...                          chunksize=chunksize, delimiter=" ",
...                          names=["src", "dst", "value"],
...                          dtype=["int32", "int32", "float32"])
>>> dg = cugraph.Graph()
>>> dg.from_dask_cudf_edgelist(ddf, source='src', destination='dst',
...                            edge_attr='value')
>>> ec = dcg.eigenvector_centrality(dg)