当前位置: 首页>>代码示例>>Java>>正文


Java Graphs.degrees方法代码示例

本文整理汇总了Java中org.nodes.Graphs.degrees方法的典型用法代码示例。如果您正苦于以下问题:Java Graphs.degrees方法的具体用法?Java Graphs.degrees怎么用?Java Graphs.degrees使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.nodes.Graphs的用法示例。


在下文中一共展示了Graphs.degrees方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: instanceLoopTest3

import org.nodes.Graphs; //导入方法依赖的package包/类
@Test
public void instanceLoopTest3()
{		
	for(int i : series(20))
	{
		UGraph<String> graph = RandomGraphs.random(100, 200);
	
		UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(graph, 100, 3, 4, 1);
		List<Integer> degrees = Graphs.degrees(graph);

		for(UGraph<String> sub : ex.subgraphs())
		{
			double sizeSlow = MotifModel.size(graph, sub, ex.occurrences(sub), new EdgeListModel(Prior.COMPLETE), true);
			double sizeOld = MotifModel.sizeEL(graph, sub, ex.occurrences(sub), true);
			double sizeNew = MotifModel.sizeEL(graph, degrees, sub, ex.occurrences(sub), true);

			
			assertEquals(sizeOld, sizeNew, 0.000001);
			assertEquals(sizeSlow, sizeNew, 0.000001);

		}
	}
}
 
开发者ID:pbloem,项目名称:motive,代码行数:24,代码来源:MotifModelTest.java

示例2: instanceLoopTestTiming

import org.nodes.Graphs; //导入方法依赖的package包/类
public void instanceLoopTestTiming()
{		
	UGraph<String> graph = RandomGraphs.randomFast(100000, 2000000);
	System.out.println("graph generated.");
	
	UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(graph, 1000000, 3, 6, 1);
	List<Integer> degrees = Graphs.degrees(graph);
	
	for(UGraph<String> sub : ex.subgraphs())
	{
		System.out.println(ex.occurrences(sub).size() + " occurrences:");
		double tOld, tNew;
		tic();
		double sizeOld = MotifModel.sizeER(graph, sub, ex.occurrences(sub), true);
		tOld = toc();
		
		tic();
		double sizeNew = MotifModel.sizeERInst(graph, sub, ex.occurrences(sub), true);
		tNew = toc();
		
		System.out.println("  old: " + tOld + " seconds");
		System.out.println("  new: " + tNew + " seconds");

	}
}
 
开发者ID:pbloem,项目名称:motive,代码行数:26,代码来源:MotifModelTest.java

示例3: instanceLoopTestTiming2

import org.nodes.Graphs; //导入方法依赖的package包/类
public void instanceLoopTestTiming2()
{		
	UGraph<String> graph = RandomGraphs.randomFast(10000, 100000);
	System.out.println("graph generated.");
	
	UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(graph, 100000, 3, 5, 1);
	List<Integer> degrees = Graphs.degrees(graph);
	
	UGraph<String> sub = ex.subgraphs().get(0);

	tic();
	for(int i : series(50))
		MotifModel.sizeEL(graph, degrees, sub, ex.occurrences(sub), true);
	System.out.println(toc() + " seconds.");
	
}
 
开发者ID:pbloem,项目名称:motive,代码行数:17,代码来源:MotifModelTest.java

示例4: instanceLoopTestERU

import org.nodes.Graphs; //导入方法依赖的package包/类
@Test
public void instanceLoopTestERU()
{		
	for(int i : series(20))
	{
		UGraph<String> graph = RandomGraphs.random(100, 200);
	
		UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(graph, 100, 3, 4, 1);
		List<Integer> degrees = Graphs.degrees(graph);

		for(UGraph<String> sub : ex.subgraphs())
		{
			double sizeSlow = MotifModel.size(graph, sub, ex.occurrences(sub), new ERSimpleModel(true), true);
			double sizeOld  = MotifModel.sizeER(graph, sub, ex.occurrences(sub), true);
			double sizeNew  = MotifModel.sizeERInst(graph, sub, ex.occurrences(sub), true);

			System.out.println(sizeSlow + " " + sizeOld + " " + sizeNew);
			
			assertEquals(sizeOld, sizeNew, 0.000001);
			assertEquals(sizeSlow, sizeNew, 0.000001);

		}
	}
}
 
开发者ID:pbloem,项目名称:motive,代码行数:25,代码来源:MotifModelTest.java

示例5: testBetaU

import org.nodes.Graphs; //导入方法依赖的package包/类
public void testBetaU()
{
	int iterations = 250;
	UGraph<String> data = RandomGraphs.random(30, 300);
	
	UPlainMotifExtractor<String> ex = new UPlainMotifExtractor<String>(data, 1000, 2, 7, 1);
	
	for(UGraph<String> sub : ex.subgraphs().subList(0, N))
	{
		UGraph<String> subbed = MotifModel.subbedGraph(
				data, ex.occurrences(sub), new ArrayList<List<Integer>>(),
				new HashSet<Integer>());
		
		subbed = Graphs.toSimpleUGraph(subbed);
		
		List<Integer> slowDegrees = Graphs.degrees(subbed);
		Collections.sort(slowDegrees);
		 
		List<Integer> fastDegrees = 
				MotifModel.subbedDegrees(data, ex.occurrences(sub), new FrequencyModel<String>()); 
		Collections.sort(fastDegrees);
		
		assertEquals(slowDegrees, fastDegrees);
		
		double sizeSlow = MotifModelTest.sizeBetaCopying(data, sub, ex.occurrences(sub), true, iterations, 0.05);
		double sizeFast = MotifModel.sizeBeta(data, sub, ex.occurrences(sub), true, iterations, 0.05);
		assertEquals(sizeSlow, sizeFast, 10.0);
		
		System.out.print('.');
	}
}
 
开发者ID:pbloem,项目名称:motive,代码行数:32,代码来源:MotifModelTest.java

示例6: instanceLoopTest

import org.nodes.Graphs; //导入方法依赖的package包/类
@Test
public void instanceLoopTest()
{
	UGraph<String> graph = new MapUTGraph<String, String>();
	
	UNode<String> a = graph.add("x");
	UNode<String> b = graph.add("x");		
	UNode<String> c = graph.add("x");
	UNode<String> d = graph.add("x");
	UNode<String> e = graph.add("x");		
	UNode<String> f = graph.add("x");
	
	a.connect(b);
	a.connect(c);
	b.connect(c);
	b.connect(e);
	c.connect(d);
	c.connect(e);
	d.connect(e);
	d.connect(f);
	e.connect(f);
	
	UGraph<String> sub = new MapUTGraph<String, String>();
	
	UNode<String> x = sub.add("x");
	UNode<String> y = sub.add("x");		
	UNode<String> z = sub.add("x");

	x.connect(y);
	y.connect(z);
	z.connect(x);
	
	List<List<Integer>> occurrences = asList(asList(0, 1, 2), asList(3, 4, 5));
	List<Integer> degrees = Graphs.degrees(graph);

	assertEquals(asList(1, 1), 
			MotifModel.subbedDegrees(graph, degrees, occurrences, 
				new FrequencyModel<Pair<Integer, Integer>>(),
				new LinkedList<List<Integer>>()));
		
	double bitsOld = MotifModel.sizeEL(graph, sub, occurrences, true);
	double bitsNew = MotifModel.sizeEL(graph, degrees, sub, occurrences, true);
	
	assertEquals(bitsOld, bitsNew, 0.000000000000001);
}
 
开发者ID:pbloem,项目名称:motive,代码行数:46,代码来源:MotifModelTest.java

示例7: instanceLoopTest2

import org.nodes.Graphs; //导入方法依赖的package包/类
@Test
public void instanceLoopTest2()
{
	UGraph<String> graph = new MapUTGraph<String, String>();
	
	UNode<String> a = graph.add("x");
	UNode<String> b = graph.add("x");		
	UNode<String> c = graph.add("x");
	UNode<String> d = graph.add("x");
	UNode<String> e = graph.add("x");		
	UNode<String> f = graph.add("x");
	
	UNode<String> g = graph.add("x");
	UNode<String> h = graph.add("x");
	UNode<String> i = graph.add("x");
	
	a.connect(b);
	a.connect(c);
	b.connect(c);
	b.connect(e);
	c.connect(d);
	c.connect(e);
	d.connect(e);
	d.connect(f);
	e.connect(f);
	
	f.connect(g);
	g.connect(h);
	h.connect(i);
	i.connect(f);
	
	UGraph<String> sub = new MapUTGraph<String, String>();
	
	UNode<String> x = sub.add("x");
	UNode<String> y = sub.add("x");		
	UNode<String> z = sub.add("x");

	x.connect(y);
	y.connect(z);
	z.connect(x);
	
	List<List<Integer>> occurrences = asList(asList(0, 1, 2), asList(3, 4, 5));
	List<Integer> degrees = Graphs.degrees(graph);
	System.out.println(degrees);

	assertEquals(asList(1, 3, 2, 2, 2), 
			MotifModel.subbedDegrees(graph, degrees, occurrences, 
				new FrequencyModel<Pair<Integer, Integer>>(),
				new LinkedList<List<Integer>>()));
		
	double bitsOld = MotifModel.sizeEL(graph, sub, occurrences, true);
	double bitsNew = MotifModel.sizeEL(graph, degrees, sub, occurrences, true);
	
	assertEquals(bitsOld, bitsNew, 0.000000000000001);
}
 
开发者ID:pbloem,项目名称:motive,代码行数:56,代码来源:MotifModelTest.java


注:本文中的org.nodes.Graphs.degrees方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。