如何计算图的熵?
我有一组随机生成的形式图,我想计算每个图的熵。同样的问题,换句话说:我有几个网络,想计算每个网络的信息内容。
以下是包含图熵正式定义的两个来源:
http://www.cs.washington.edu/homes/anuprao/pubs/CSE533Autumn2010/讲座4.pdf (PDF) http://arxiv.org/abs/0711.4175v1
我正在寻找的代码将图表作为输入(作为边缘列表或邻接矩阵)并输出许多位或信息内容的一些其他度量。
因为我在任何地方都找不到它的实现,所以我开始根据正式定义从头开始编写代码。如果有人已经解决了这个问题并且愿意分享代码,我们将不胜感激。
I have a set of randomly generated formal graphs, and I would like to calculate the entropy of each one. The same question in different words: I have several networks, and want to calculate the information content of each one.
Here are two sources containing formal definitions of graph entropy:
http://www.cs.washington.edu/homes/anuprao/pubs/CSE533Autumn2010/lecture4.pdf (PDF)
http://arxiv.org/abs/0711.4175v1
The code I am looking for takes a graph as input (as either an edge list or an adjacency matrix) and outputs a number of bits or some other measure of information content.
Because I can't find an implementation of this anywhere, I am setting out to code this from scratch based on the formal definitions. If anyone has already solved this problem and is willing to share the code, it would be wildly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我最终使用不同的论文来定义图熵:
复杂网络的信息论:论演化和架构约束
RV Sole 和 S. Valverde (2004)
和
基于拓扑配置的网络熵及其对随机网络的计算
BH Wang、WX Wang 和 T. Zhou
计算每个值的代码如下。该代码假设您有一个无向、未加权的图,没有自循环。它以邻接矩阵作为输入并返回以位为单位的熵量。它是在 R 中实现的,并使用 sna 包。
I ended up using different papers for definitions of graph entropy:
Information Theory of Complex Networks: On Evolution and Architectural Constraints
R.V. Sole and S. Valverde (2004)
and
Network Entropy Based on Topology Configuration and Its Computation to Random Networks
B.H. Wang, W.X. Wang and T. Zhou
The code to calculate each is below. The code assumes you have an undirected, unweighted graph with no self-loops. It takes an adjacency matrix as input and returns the amount of entropy in bits. It is implemented in R and makes use of the sna package.
如果您有一个加权图,一个好的开始就是对所有权重进行排序和计数。然后,您可以使用公式 -log(p)+log(2) (http://en.wikipedia.org/wiki/Binary_entropy_function) 来确定代码所需的位数。也许这不起作用,因为它是二元熵函数?
If you have a weighted graph a good start would be to sort and count all the weights. Then you can use the formula -log(p)+log(2) (http://en.wikipedia.org/wiki/Binary_entropy_function) to determine the amount of bits to be needed for the code. Maybe this doesn't work because it's the binary entropy function?
您可以使用 Koerner 熵(= 应用于图表的香农熵)。一个很好的参考文献是此处。但请注意,计算通常是 NP 困难的(出于愚蠢的原因,您需要搜索顶点的所有子集)。
You can use Koerner's entropy (= Shannon entropy applied to a graph). A good reference for the literature is here. Note however that the computation is in general NP-hard (for the stupid reason that you need to search of the all subsets of vertices).