日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java link_Java Link类代码示例

發(fā)布時間:2025/3/15 java 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java link_Java Link类代码示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

import org.nodes.Link; //導(dǎo)入依賴的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();

}

總結(jié)

以上是生活随笔為你收集整理的java link_Java Link类代码示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。