import org.nodes.Link; //导入依赖的package包/类

public static double sizeBetaCopying(DGraph graph, DGraph sub,

List> occurrences, boolean resetWiring, int iterations, double alpha)

{

int numThreads = Runtime.getRuntime().availableProcessors();

List> wiring = new ArrayList>();

Set motifNodes = new HashSet();

DGraph subbed = MotifModel.subbedGraph(graph, occurrences, wiring, motifNodes);

// * the beta model can only store simple graphs, so we translate subbed

// to a simple graph and store the multiple edges separately

FrequencyModel> removals = new FrequencyModel>();

subbed = Graphs.toSimpleDGraph((DGraph)subbed, removals);

// * The estimated cost of storing the structure of the motif and the

// structure of the subbed graph.

List samples = new ArrayList(iterations);

DSequenceEstimator motifModel = new DSequenceEstimator(sub);

DSequenceEstimator subbedModel = new DSequenceEstimator(subbed);

motifModel.nonuniform(iterations, numThreads);

subbedModel.nonuniform(iterations, numThreads);

for(int i : series(iterations))

samples.add(motifModel.logSamples().get(i) + subbedModel.logSamples().get(i));

LogNormalCI ci = new LogNormalCI(samples);

// * The rest of the graph (for which we can compute the code length

// directly)

FrequencyModel rest = new FrequencyModel();

// * parameters

rest.add("sub", DegreeSequenceModel.prior((DGraph>)sub, Prior.COMPLETE));

// * size of the subbed graph

// * degree sequence of subbed

rest.add("subbed", DegreeSequenceModel.prior((DGraph>)subbed, Prior.COMPLETE));

// * Store the labels

rest.add("labels", log2Choose(occurrences.size(), subbed.size()));

// * Any node pairs with multiple links

List additions = new ArrayList();

for(Link link : subbed.links())

if(motifNodes.contains(link.first().index()) || motifNodes.contains((link.second().index())))

{

int i = link.first().index(), j = link.second().index();

Pair pair = Pair.p(i, j);

additions.add((int)removals.frequency(pair));

}

rest.add("multi-edges", Functions.prefix(additions.isEmpty() ? 0 : (long) Functions.max(additions)));

rest.add("multi-edges", OnlineModel.storeIntegers(additions));

// * Store the rewiring information

rest.add("wiring", MotifModel.wiringBits(sub, wiring, resetWiring));

// * Store the insertion order, to preserve the precise ordering of the

// nodes in the data

rest.add("insertions", log2Factorial(graph.size()) - log2Factorial(subbed.size()));

//System.out.println("ci : " + ci.upperBound(alpha));

//rest.print(System.out);

return ci.upperBound(alpha) + rest.total();

}

java link_Java Link类代码示例相关推荐

  1. java dataconvert_Java DateConverter类代码示例

    import org.apache.commons.beanutils.converters.DateConverter; //导入依赖的package包/类 /** * Register array ...

  2. java backoff_Java BackOff类代码示例

    import org.apache.beam.sdk.util.BackOff; //导入依赖的package包/类 /** * Writes a batch of mutations to Clou ...

  3. java direction_Java Direction类代码示例

    import android.support.test.uiautomator.Direction; //导入依赖的package包/类 /** * Navigates through the foc ...

  4. java parseexception_Java ParseException类代码示例

    import com.sun.org.apache.xerces.internal.impl.xpath.regex.ParseException; //导入依赖的package包/类 @Overri ...

  5. java bar_Java Bar类代码示例

    import com.db.chart.model.Bar; //导入依赖的package包/类 @Override protected void onCreate(Bundle savedInsta ...

  6. java widget_Java FavoritesWidget类代码示例

    import com.google.gwt.sample.dynatablerf.client.widgets.FavoritesWidget; //导入依赖的package包/类 /** * Thi ...

  7. java plugin_Java Plugin类代码示例

    import org.apache.logging.log4j.core.config.plugins.Plugin; //导入依赖的package包/类 /** * @since 2.1 */ pu ...

  8. java jsonresult_Java JsonResult类代码示例

    import eu.socialsensor.framework.client.search.visual.JsonResultSet.JsonResult; //导入依赖的package包/类 @O ...

  9. postgresql java demo_Java PostgreSQL9Dialect类代码示例

    import org.hibernate.dialect.PostgreSQL9Dialect; //导入依赖的package包/类 private void addDialects(Strategy ...

最新文章

  1. 张恩民 php,php100视频教程第11讲(制作PHP+MYSQL留言板 上)中,张恩民老师提到的php100-11.txt文档...
  2. VS2015静态编译libcurl(C++ curl封装类)
  3. 初学Java Web(8)——过滤器和监听器
  4. 预处理阶乘和阶乘逆元_计算数字的阶乘| 8086微处理器
  5. java界面布局都有什么_java入門教程-10.5Java圖形界面之布局設計
  6. sqlserver数据库安装后服务配置
  7. 视觉SLAM十四讲学习笔记-第七讲-视觉里程计-对极几何和对极约束、本质矩阵、基础矩阵
  8. python安装dlib要cmake,如何使用cmake解决dlib错误?
  9. 配置生产环境加路径 /开发环境
  10. 有趣的视频 国外计算机课程
  11. 时序图(Sequence Diagram)—UML图(六)
  12. oracle 主要语句大荟萃
  13. json_decode 打印 null
  14. 【Object C】从Java 一步步走向Object C
  15. java中的输入输出流概念_Java输入输出(IO)和流的基本概念
  16. 【Python游戏】Python实现一个推箱子小游戏 | 附带源码
  17. C#打包文件夹成zip格式(包括文件夹和子文件夹下的所有文件)
  18. ATMel的AT89C52芯片慎选
  19. linux安装globalsign证书,globalsign代码签名证书
  20. 【Leetcode】469. Convex Polygon

热门文章

  1. java中.of,java中instanceof的用法
  2. html中删除代码怎么写,html空格代码怎么写?
  3. oracle河南城建学院实验报告,数据处理实验报告
  4. 自定义键盘码_无线+矮轴≤299?ikbc S200 2.4G 机械键盘测评
  5. 机器学习之线性回归(python)
  6. Python数模笔记-模拟退火算法(2)约束条件的处理
  7. dsp实现快速傅里叶的C语言程序,DSP-快速傅立叶变换(FFT)算法实验
  8. linux根目录cat退出,Linux展示cat帮助信息并退出
  9. python调用shell脚本的参数_使用python执行shell脚本 并动态传参 及subprocess的使用详解
  10. java 代码锁_Java中的Lock锁