0

I've an application where I have a graph and I need to count the number of triangles in the graph using MrJob (MapReduce in Python). However, I'm having some trouble wrapping my head around the mapping and the reducing steps needed. What is the best Map Reduce pipeline for computing the triangles of a network graph?

chribsen
  • 6,232
  • 4
  • 26
  • 24

2 Answers2

0

Well, it would help to answer this to have a bit more context. Do you have a single graph or a large number of graphs, a tree? How many nodes are we talking about in your graph?

But in general, I would try to build a solution that uses the networkx package, specifically the triangles method at the core.

An issue you may face is filtering duplicates, as the triangles are reported relative to a node.

So a bit more context here on the specifics here would help narrow down the answer.

jeffmcc
  • 263
  • 3
  • 9
0

Since you want to compute the triangles on a big network graph in parallel. You might be interested in GraphScope. This is the description:

GraphScope is a unified distributed graph computing platform that provides a one-stop environment for performing diverse graph operations on a cluster of computers through a user-friendly Python interface. GraphScope makes multi-staged processing of large-scale graph data on compute clusters simple by combining several important pieces of Alibaba technology: including GRAPE, GraphCompute, and Graph-Learn (GL) for analytics, interactive, and graph neural networks (GNN) computation, respectively.

Here is the quickly started of GraphScope:

# install graphscope by pip
pip3 install graphscope
>>> import graphscope
>>> graphscope.set_option(show_log=True)
>>>
>>> # load graph
>>> from graphscope.dataset import load_p2p_network
>>> g = load_p2p_network()
>>>
>>> # run sssp algorithm
>>> pg = g.project(vertices={"host": ["id"]}, edges={"connect": ["dist"]})
>>> c = graphscope.triangles(pg)

Refer to How to Run and Develop GraphScope Locally and GraphScope Doc for more information.

lidongze
  • 11
  • 2