Evaluate triangle counting of the graph G. Args: graph (:class:`graphscope.Graph`): A simple graph. Returns: :class:`graphscope.framework.context.VertexDataContextDAGNode`: A context with each vertex assigned with the triangle counting result, evaluated in eager
(graph)
| 31 | @project_to_simple |
| 32 | @not_compatible_for("arrow_property", "dynamic_property") |
| 33 | def triangles(graph): |
| 34 | """Evaluate triangle counting of the graph G. |
| 35 | |
| 36 | Args: |
| 37 | graph (:class:`graphscope.Graph`): A simple graph. |
| 38 | |
| 39 | Returns: |
| 40 | :class:`graphscope.framework.context.VertexDataContextDAGNode`: |
| 41 | A context with each vertex assigned with the triangle counting result, evaluated in eager mode. |
| 42 | |
| 43 | Examples: |
| 44 | |
| 45 | .. code:: python |
| 46 | |
| 47 | >>> import graphscope |
| 48 | >>> from graphscope.dataset import load_p2p_network |
| 49 | >>> sess = graphscope.session(cluster_type="hosts", mode="eager") |
| 50 | >>> g = load_p2p_network(sess) |
| 51 | >>> # project to a simple graph (if needed) |
| 52 | >>> pg = g.project(vertices={"host": ["id"]}, edges={"connect": ["dist"]}) |
| 53 | >>> c = graphscope.triangles(pg) |
| 54 | >>> sess.close() |
| 55 | |
| 56 | """ |
| 57 | if graph.is_directed(): |
| 58 | logger.warning( |
| 59 | "Triangles may not be consistent when be queried upon directed graph." |
| 60 | ) |
| 61 | return AppAssets(algo="triangles", context="vertex_data")(graph) |
nothing calls this directly
no test coverage detected