![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
AI_Mathworker
本人现于山东大学数学学院攻读信息与计算科学学位,入门计算机,对数据分析与挖掘尤感兴趣,仅以此记录和分享学习的点点滴滴,如有纰漏,不吝赐教。
展开
-
构建贝叶斯网络——K2算法(Python实现)
K2算法伪代码如下:主要思想是贪婪思想,这样也可以保证每次插入的边不构成环。from factor import factimport mathimport randomFile = open('C:\\Users\\lenovo\Desktop\\网络科学导论cpp代码\\时序网络数据集\\email-Eu-core-temporal-Dept3.txt', 'r')lineList = File.readlines()print(len(lineList))#该数据文件共有12.原创 2020-06-08 16:26:10 · 4917 阅读 · 8 评论 -
BGLL算法 C++实现
实际上,BGLL算法就是在CNM算法的基础之上,再进一步,通过将CNM算法的结果中处于同一个社团的节点看作一个节点,再使用CNM算法进行社团划分,照此步骤反复迭代,每一次迭代记作一个pass,直到无法继续划分为止(就是在节点合并后,Q也不再增加)。从而尽量减轻因CNM算法的贪心策略造成的社团划分效果不佳,CNM算法实现可参考前文《CNM算法C++实现》下文示例数据下载链接:facebook_c...原创 2020-01-08 12:11:10 · 844 阅读 · 5 评论 -
幂法求矩阵最大特征值及其对应的特征向量 C++实现
#include<iostream>#include<cstring>#include<algorithm>#include<math.h>#define N 1100using namespace std;int n,flag;float m,next_m,eclipse,sum,A[N][N],z[N],y[N],next_z[N...原创 2020-01-08 11:52:40 · 3802 阅读 · 0 评论 -
CNM算法C++实现
博主第一次写社团划分的算法,原本CNM算法应该是通过维护一个大根堆来实现的,因为对这个算法还没那么熟,所以用的普通方法和邻接矩阵来实现的。不过不管怎么说,算法的基于贪婪策略,根据模块度划分社团的核心思想一定是不变的。公式的话,应该已经有不少文章介绍,大家可以参考,我就只贴代码了。#include<iostream>#include<cstring>#define ...原创 2020-01-06 15:08:28 · 3309 阅读 · 0 评论 -
FBI树(先递归构建二叉树,再后序遍历之)
#include <iostream>#include <algorithm>#include <math.h>using namespace std;#define N 1200char arrr[N];int arr[N];typedef struct S{ char type; S *lchild; S *rchild;}tree...原创 2019-08-15 23:22:42 · 220 阅读 · 0 评论 -
C++实现精确覆盖(dlx)。
参考自https://www.cnblogs.com/Rhein-E/p/8969773.html#include <iostream>using namespace std;#define N 1010typedef struct node{ int data; struct node *left; struct node *right; struct node...原创 2019-08-28 19:26:48 · 479 阅读 · 0 评论 -
UVa1592 Database
为每个字符串标号(利用vector和map实现string->int的转换),然后再遍历之。#include <iostream>#include <map>#include <string>#include<utility>#include <vector>#include <set>using na...原创 2019-09-07 18:18:08 · 166 阅读 · 0 评论 -
最小费用最大流(Bellman-Ford)C++实现
#include <iostream>#include <queue>#include <vector>#include <algorithm>using namespace std;#define N 1010typedef struct edge{ int from; int to; int cap; int flow;...原创 2019-09-12 20:00:53 · 839 阅读 · 0 评论