本文整理汇总了Java中org.nodes.Graphs.fromBits方法的典型用法代码示例。如果您正苦于以下问题:Java Graphs.fromBits方法的具体用法?Java Graphs.fromBits怎么用?Java Graphs.fromBits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nodes.Graphs
的用法示例。
在下文中一共展示了Graphs.fromBits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: print
import org.nodes.Graphs; //导入方法依赖的package包/类
/**
* Mapping from binary strings to canonical graphs
*/
// @Test
public void print()
{
for(int n : series(2, 6))
{
final int m = (n*n-n)/2;
Set<Graph<String>> seen = new HashSet<Graph<String>>();
for(BitString bits : BitString.all(m))
{
UGraph<String> g = Graphs.fromBits(bits, "");
if(Graphs.connected(g) && ! seen.contains(Nauty.canonize(g)))
{
System.out.println(bits + "\t" + g);
seen.add(Nauty.canonize(g));
}
}
}
}
示例2: sumtest
import org.nodes.Graphs; //导入方法依赖的package包/类
public void sumtest()
{
int n = 20;
Set<BitString> set = new LinkedHashSet<BitString>();
for(double p : Series.series(0.05, 0.05, 1.0))
for(int i : Series.series(100))
set.add(BitString.random((n*n-n)/2, p));
List<Double> valuesER = new ArrayList<Double>(set.size());
List<Double> valuesEL = new ArrayList<Double>(set.size());
for(BitString bs : set)
{
UGraph<String> graph = Graphs.fromBits(bs, "");
try {
UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(graph, 5000, 2, 3);
for(UGraph<String> sub : ex.subgraphs())
{
valuesER.add(- MotifSearchModel.sizeER(graph, sub, ex.occurrences(sub), true));
valuesEL.add(- MotifSearchModel.sizeEL(graph, sub, ex.occurrences(sub), true));
}
} catch(Exception e)
{
System.out.println("EXCEPTION CAUGHT " + e);
}
}
double sumER = - Functions.log2Sum(valuesER);
double sumEL = - Functions.log2Sum(valuesEL);
System.out.println("sum ER: " + sumER);
System.out.println("sum EL: " + sumEL);
assertTrue(sumER > 0.0);
assertTrue(sumEL > 0.0);
}