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)
| 58 | @project_to_simple |
| 59 | @not_compatible_for("arrow_property", "dynamic_property") |
| 60 | def 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 |
nothing calls this directly
no test coverage detected