什么是一个高效的算法计算在图中三角形的数量? [英] What is an efficient algorithm for counting the number of triangles in a graph?

查看:592
本文介绍了什么是一个高效的算法计算在图中三角形的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是一个有效的算法,用于计算无向图三角形的数量)(其中一个图是一组顶点和边)?我一直在寻找谷歌,并通过我的教科书的书架阅读了几个小时,在连续三天时间一天。

What is an efficient algorithm for counting the number of triangles in an undirected graph )(where a graph is a set of vertices and edges)? I've been searching Google and reading through my shelf of textbooks for a few hours each day for three days in a row.

这是一个家庭作业,我需要这样的算法,但发展不计数的赋值东西。据预计,我们可以简单地寻找外部资源,这样的算法,但我在我的绳子结束。

This is for a homework assignment where I need such an algorithm, but developing it doesn't count for anything on the assignment. It is expected that we can simply find such an algorithm from outside resources, but I'm at the end of my rope.

有关澄清,图中的一个三角形是长度为3的氨基酸周期。诀窍在于,它需要至多一万个节点工作的顶点集。

For clarification, a triangle in a graph is a a cycle of length three. The trick is that it needs to work on vertex sets with at most 10,000 nodes.

我目前的工作在C#中,但更关心对解决这个问题,而不是code复制和粘贴的一般方法。

I'm currently working in C#, but care more about the general approach towards solving this problem than code to copy and paste.

在较高的水平,我尝试迄今包括:

At the high level, my attempts thus far included:

  • 的跟踪长度为3的所有独特的循环广度优先搜索。这似乎是一个好主意给我,但我无法得到它的功能
  • 系统遍历图中的所有节点,看看三个顶点共享的优势。这有过于缓慢的运行时间为更大的数据集。为O(n ^ 3)。

该算法本身是一种计算集群系数的组成部分。

The algorithm itself is part of calculating the clustering coefficient.

推荐答案

这个问题很难,因为矩阵乘法。对于参考的看到这一点。

This problem is as hard as matrix multiplication. See this for reference.

你知道图表什么?他们是疏?如果没有,我不认为你会做的比为O(n ^ 3)要好得多。

Do you know anything about the graphs? Are they sparse? If not, I don't think you are going to do much better than O(n^3).

这篇关于什么是一个高效的算法计算在图中三角形的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆