cugraph.ego_graph#

cugraph.ego_graph(G, n, radius=1, center=True, undirected=None, distance=None)[source]#

Compute ego graph(s) centered at one or more seed vertices.

Parameters:
Gcugraph.Graph, CuPy or SciPy sparse matrix

Input graph.

ninteger, list, cudf.Series, or cudf.DataFrame

A single seed vertex or multiple seed vertices. For multi-column vertices, each row of a cudf.DataFrame represents one seed.

radiusinteger, optional

Include neighbors at distance less than or equal to radius.

centerbool, optional

Defaults to True. False is not supported.

undirectedoptional

Present for NetworkX compatibility and currently ignored.

distanceoptional

Present for NetworkX compatibility and currently ignored.

Returns:
cugraph.Graph

The ego graph when one seed vertex is supplied.

list of cugraph.Graph

Ego graphs ordered to match the supplied seeds when multiple seed vertices are supplied.

Notes

The high-level API returns one Graph per seed. Users requiring the combined edge output and offsets for maximum batching efficiency can call pylibcugraph.ego_graph directly.