java link_Java Link类代码示例

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();

}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/574382.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

go read text file into string array

http://stackoverflow.com/questions/5884154/golang-read-text-file-into-string-array-and-write 方法一 1 package main2 3 import (4 "bufio"5 "fmt"6 "log"7 "os"8 )9 10 // readLines reads a whole file into memory …

des加密 ios 和java_三重Des对称加密在Android、Ios 和Java 平台的实现

//// CommonFunc.m// PRJ_base64//// Created by wangzhipeng on 12-11-29.// Copyright (c) 2012年 com.comsoft. All rights reserved.//#import "MyBase64.h"//引入IOS自带密码库#import //空字符串#define LocalStr_None ""static const char en…

BZOJ2976 : [Poi2002]出圈游戏

首先模拟一遍得到n个同余方程&#xff0c;然后用扩展欧几里得求出最小的可行解即可&#xff0c;时间复杂度$O(n^2)$。 #include<cstdio> #define N 30 int n,i,j,k,x,y,a[N],b[N],d[N],ans; namespace Solve{ int flag1,k1,m0,d,x,y; int exgcd(int a,int b,int&x,in…

java awt 教程_JAVA教程 第五讲 AWT图形用户界面设计

5.1 用AWT生成图形化用户界面抽象窗口工具包AWT (Abstract Window Toolkit) 是 API为Java 程序提供的建立图形用户界面GUI (Graphics User Interface)工具集&#xff0c;AWT可用于Java的applet和applications中。它支持图形用户界面编程的功能包括&#xff1a; 用户界面组件&am…

从C# String类理解Unicode(UTF8/UTF16)

上一篇博客&#xff1a;从字节理解Unicode&#xff08;UTF8/UTF16)。这次我将从C# code 中再一次阐述上篇博客的内容。 C# 代码看UTF8 代码如下&#xff1a; string test "UTF-8你"; //把字符转换为 byte[] byte[] bytearray_UTF8 Encoding.UTF8.GetBytes(test)…

java mvc mvp_MVC和MVP设计模式

参考博客http://www.cnblogs.com/end/archive/2011/06/02/2068512.html####MVC模式M&#xff1a;model 模型V&#xff1a;view视图C&#xff1a;controller控制器>我们知道&#xff0c;所有的软件的构成主要有两部分&#xff0c;分别是用户交互入口(USER INTERFACE)和数据(D…

python浅拷贝深拷贝

copy_listlist[:] 得到的是浅拷贝&#xff0c;即只能顶层拷贝&#xff0c;里面的嵌套不会复制一份。 a [0, [1, 2], 3] b a[:] a[0] 8 a[1][1] 9 请问现在a和b分别是多少&#xff1f; 答案&#xff1a;是 a 为 [8, [1, 9], 3]&#xff0c;b 为 [0, [1, 9], 3]。 b的第二个…

[转载] KAFKA分布式消息系统

转载自http://blog.chinaunix.net/uid-20196318-id-2420884.html Kafka[1]是linkedin用于日志处理的分布式消息队列&#xff0c;linkedin的日志数据容量大&#xff0c;但对可靠性要求不高&#xff0c;其日志数据主要包括用户行为&#xff08;登录、浏览、点击、分享、喜欢&…

java sleep唤醒_JAVA wait(), notify(),sleep详解(转)

在JAVA中&#xff0c;是没有类似于PV操作、进程互斥等相干的方法的。JAVA的进程同步是通过synchronized()来实现的&#xff0c;需要说明的是&#xff0c;JAVA的synchronized()方法类似于操作系统概念中的互斥内存块&#xff0c;在JAVA中的Object类型中&#xff0c;都是带有1个内…

ACM 错排

Description 大家常常感慨&#xff0c;要做好一件事情真的不容易&#xff0c;确实&#xff0c;失败比成功容易多了&#xff01; 做好“一件”事情尚且不易&#xff0c;若想永远成功而总从不失败&#xff0c;那更是难上加难了&#xff0c;就像花钱总是比挣钱容易的道理一样。 话…

Linux的NTP配置总结

在Linux系统中&#xff0c;为了避免主机时间因为在长时间运行下所导致的时间偏差&#xff0c;进行时间同步(synchronize)的工作是非常必要的。Linux系统下&#xff0c;一般使用ntp服务来同步不同机器的时间。NTP 是网络时间协议&#xff08;Network Time Protocol&#xff09;的…

mysql_real_connect阻塞_mysql_real_connect崩溃、未经处理的异常

mysql_real_connect崩溃、未经处理的异常背景近期客户测试软件&#xff0c;功能里有mysql连接问题&#xff0c;在mysql连接失败时&#xff0c;客户机器上出现“已停止工作”界面&#xff0c;而我机器上软件直接退出没有提示自动关闭。查找分析因为是一直用的代码&#xff0c;和…

java中settimeout作用_关于setTimeout的妙用

定义在指定的延迟时间之后调用一个函数或执行一个代码片段这个是setTimeout最主要的功能&#xff0c;但也是很坑的地方&#xff0c;首先javascript其实是运行在单线程的环境下&#xff0c;意味者定时器会在未来的某个时间支持&#xff0c;但是具体的执行的时间并不能够很准确的…

中兴的一道笔试题

今天做了中兴的秋招题目&#xff0c;有一个题以前没有仔细想过&#xff0c;题目我有点儿记不清楚了&#xff0c;大概意思是这样的&#xff1a;有一个循环的单链表&#xff0c;给定该链表的尾指针比给定头指针好么&#xff1f; 我的思路&#xff1a;如下图&#xff0c;这是一个循…

Linux read 命令

Linux read命令用于从标准输入读取数值。 read 内部命令被用来从标准输入读取单行数据。这个命令可以用来读取键盘输入&#xff0c;当使用重定向的时候&#xff0c;可以读取文件中的一行数据。 语法 read [-ers] [-a aname] [-d delim] [-i text] [-n nchars] [-N nchars] […

放图片 java_java怎么在我想要的图片上在放一个我想要的图片

展开全部import javax.imageio.*;import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.awt.geom.*;import java.io.*;import java.util.*;/*** author Hardneedl*/final class PicDemo extends JFrame {public String getTitle() {return "PicDe…

Ext-ajax请求数据

Ext.Ajax.request({url: webPath/news/newsEastmoneyList,method: POST,success: function (response, options) {var data Ext.decode(response.responseText);if(data.success){list.getStore().load({page:1});Ext.Msg.alert(提示,提取成功&#xff0c;共提取data.zg条.);}…

java .net des_DES加密解密 JAVA与.NET互通程序代码

JAVA版本import javax.crypto.Cipher;import javax.crypto.SecretKey;import javax.crypto.SecretKeyFactory;import javax.crypto.spec.DESKeySpec;import javax.crypto.spec.IvParameterSpec;public class Des {private byte[] desKey;//解密数据public static String decryp…

linux 查找文件或者服务

[rootlocalhost ~]# whereis mysql mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz [rootlocalhost ~]# which mysql /usr/bin/mysql转载于:https://www.cnblogs.com/adolfmc/p/4749224.html

android java 调用js_android WebApp 集成方式怎么使用java调用js

WebAPP集成&#xff0c;本地打包&#xff0c;有两种方式java js通信1.DCloud插件模式&#xff0c;参考SDK DEMO的H5Plugin&#xff0c;Java:继承StandardFeature写接口。public class DBControlPlugin extends StandardFeature{public void PluginTestFunction(IWebview pWebvi…