reach_graph_per_source

Computes a separate reach graph for each given source node.

sasviya.network.algorithms.reach.reach_graph_per_source(g, source, max_reach=1, *, data=True)

This is the induced subgraph of the set of nodes that are reachable within a given number of steps (or hops) to that source node. Reach networks are often referred to as ego networks in the context of social networks.

Parameters

g : SAS graph object

Specifies the input graph to assess.

source : node or iterable of nodes

Specifies one or more source nodes from which to compute the reach network.

max_reach : int, optional

Specifies the number of steps (or hops) to traverse from the source nodes. The default is 1.

data : bool, optional

Specifies whether or not to retain attributes. The default is True, which means that the node and edge attributes of the graph are retained.

Yields

generator

Yields a generator of subgraphs; each subgraph represents one reach network. The generator has the solution_summary attribute, which contains information about the results of the algorithm.

Last updated: July 28, 2026