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

Compute the induced subgraph of neighbors for each node in seeds within a given radius.

Gcugraph.Graph, networkx.Graph, CuPy or SciPy sparse matrix

Graph or matrix object, which should contain the connectivity information. Edge weights, if present, should be single or double precision floating point values.

seedscudf.Series or list or cudf.DataFrame

Specifies the seeds of the induced egonet subgraphs.

radius: integer, optional (default=1)

Include all neighbors of distance<=radius from n.

center: bool, optional

Defaults to True. False is not supported

undirected: bool, optional

Defaults to False. True is not supported

distance: key, optional (default=None)

Distances are counted in hops from n. Other cases are not supported.

ego_edge_listscudf.DataFrame or pandas.DataFrame

GPU data frame containing all induced sources identifiers, destination identifiers, edge weights

seeds_offsets: cudf.Series

Series containing the starting offset in the returned edge list for each seed.


>>> from cugraph.datasets import karate
>>> G = karate.get_graph(download=True)
>>> b_ego_graph, offsets = cugraph.batched_ego_graphs(G, seeds=[1,5],
...                                                   radius=2)