简体   繁体   English

找出 n 个节点的所有可能的连通图和有向图的数量

[英]To find out the number of all possible connected and directed graphs for n nodes

Hello stackoverflow community,你好,stackoverflow 社区,
I need to find out the number of all possible connected and directed graphs for n nodes.我需要找出 n 个节点的所有可能的连通图和有向图的数量。

For example: 3 node graphs can have 13 possible combinations which are:例如:3 个节点图可以有 13 种可能的组合,它们是:图片

CONDITIONS: As you can see in the above image,条件:如上图所示,
->3 node connected graph can never have just 1 edge, atleast two edges are required to connect all 3 nodes. -> 3 节点连接图永远不能只有 1 条边,至少需要两条边来连接所有 3 个节点。 So all nodes should be connected.所以应该连接所有节点。
->Maximum edges = 6 in 3 nodes. -> 最大边数 = 3 个节点中的 6 个。 (See graph number 13 in the image, it got 6 edges) (参见图像中的图 13,它有 6 个边)
->There can be no self edge. ->不能有自我边缘。

Similarly 4 nodes will have 199 connected directed graphs.类似地,4 个节点将有 199 个连接的有向图。
To sum up:总结:
2 nodes = 3 graphs 2 个节点 = 3 个图
3 nodes = 13 graphs 3 个节点 = 13 个图
4 nodes = 199 graphs 4 个节点 = 199 个图
5 nodes = 9364 graphs 5 个节点 = 9364 个图
6 nodes = 1530843 graphs 6 个节点 = 1530843 个图

I need a formula for F(n) so that I can get the total number of graphs for n nodes just by calculating the formula instead of doing exhaustive search to try each and every possible combination.我需要一个 F(n) 的公式,这样我就可以通过计算公式而不是进行详尽的搜索来尝试每个可能的组合来获得 n 个节点的图总数。
F(2) = 3 F(2) = 3
F(3) = 13 F(3) = 13
F(4) = 199 F(4) = 199
F(5) = 9364 F(5) = 9364
F(6) = 1530843 F(6) = 1530843

what is F(n) where n can be any natural number ?什么是 F(n) 其中 n 可以是任何自然数?

I have been trying to solve this puzzle since many days but couldn't figure it out, so I am using exhaustive methods to find out the number, but they are not feasable.很多天以来我一直试图解决这个难题但无法弄清楚,所以我使用了详尽的方法来找出数字,但它们不可行。

The Online Encyclopedia of Integer Sequences (OEIS) is useful for things like this.整数序列在线百科全书 (OEIS) 对此类事情很有用。 Below is a link to this sequence, which in turn has references you can use to learn more.以下是此序列的链接,其中包含可用于了解更多信息的参考资料。

http://oeis.org/A003085 http://oeis.org/A003085

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM