MCPcopy Create free account
hub / github.com/alibaba/GraphScope / lcc

Function lcc

python/graphscope/analytical/app/clustering.py:60–85  ·  view source on GitHub ↗

Local clustering coefficient of a node in a Graph is the fraction of pairs of the node’s neighbors that are adjacent to each other. Args: graph (:class:`graphscope.Graph`): A simple graph. Returns: :class:`graphscope.framework.context.VertexDataContextDAGNode`:

(graph)

Source from the content-addressed store, hash-verified

58@project_to_simple
59@not_compatible_for("arrow_property", "dynamic_property")
60def lcc(graph):
61 """Local clustering coefficient of a node in a Graph is the fraction
62 of pairs of the node’s neighbors that are adjacent to each other.
63
64 Args:
65 graph (:class:`graphscope.Graph`): A simple graph.
66
67 Returns:
68 :class:`graphscope.framework.context.VertexDataContextDAGNode`:
69 A context with each vertex assigned the computed clustering value, will be evaluated in eager mode.
70
71 Examples:
72
73 .. code:: python
74
75 >>> import graphscope
76 >>> from graphscope.dataset import load_p2p_network
77 >>> sess = graphscope.session(cluster_type="hosts", mode="eager")
78 >>> g = load_p2p_network(sess)
79 >>> # project to a simple graph (if needed)
80 >>> pg = g.project(vertices={"host": ["id"]}, edges={"connect": ["dist"]})
81 >>> c = graphscope.lcc(pg)
82 >>> sess.close()
83 """
84 algo = "lcc_directed" if graph.is_directed() else "lcc"
85 return AppAssets(algo=algo, context="vertex_data")(graph)
86
87
88@project_to_simple

Callers

nothing calls this directly

Calls 2

AppAssetsClass · 0.90
is_directedMethod · 0.45

Tested by

no test coverage detected