projected_graph_cosine

Computes a cosine projected graph.

sasviya.network.algorithms.projection.projected_graph_cosine(g, nodes, edge_weight=None, neighbors=None, directed_method=None, *, data=True)

Parameters

g : SAS graph object

Specifies the input graph to assess.

nodes : list or iterable

Specifies the subset of nodes to project onto.

edge_weight : str or None, optional

Specifies the edge attribute that corresponds to the edge weight. The default is None, which means that a weight of 1 is assumed for all edges.

neighbors : list or iterable, optional

Specifies the subset of nodes to project through. By default, this subset consists of all nodes in g other than those that are specified by the nodes parameter.

directed_method : {‘converging’, ‘diverging’, ‘transitive’}, optional

Specifies a method to use for projecting directed graphs. By default, the ‘converging’ method is used.

data : bool, optional

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

Returns

SAS graph object

Returns a graph representation of the node pairs with common neighbors among the neighbors subset of nodes. The strength of association in the calculated projection is represented by the ‘cosine’ edge attribute.

Last updated: July 28, 2026