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


Java Ranking类代码示例

本文整理汇总了Java中edu.uci.ics.jung.algorithms.importance.Ranking的典型用法代码示例。如果您正苦于以下问题:Java Ranking类的具体用法?Java Ranking怎么用?Java Ranking使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Ranking类属于edu.uci.ics.jung.algorithms.importance包,在下文中一共展示了Ranking类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: recalculate

import edu.uci.ics.jung.algorithms.importance.Ranking; //导入依赖的package包/类
protected void recalculate(
	Graph graph,
	Vertex startingVertex,
	boolean fixAxes) {
	DegreeDistributionRanker degreeRanker =
		new DegreeDistributionRanker(graph, true);
	degreeRanker.setRemoveRankScoresOnFinalize(false);
	degreeRanker.evaluate();
	List rankingList = degreeRanker.getRankings();
	Ranking degreeMax = (Ranking) rankingList.get(0);
	Ranking degreeMin = (Ranking) rankingList.get(rankingList.size() - 1);

	Set priors = new HashSet();
	priors.add(startingVertex);

	PageRankWithPriors pageRank =
		new PageRankWithPriors( (DirectedGraph)graph, .2, priors, null);
	pageRank.setRemoveRankScoresOnFinalize(false);
	pageRank.evaluate();
	rankingList = pageRank.getRankings();
	Ranking pageRankMax = (Ranking) rankingList.get(0);
	Ranking pageRankMin = (Ranking) rankingList.get(rankingList.size() - 1);

	BetweennessCentrality bc = new BetweennessCentrality(graph, true);
	bc.setRemoveRankScoresOnFinalize(false);
	bc.evaluate();
	rankingList = bc.getRankings();
	Ranking betwennessMax = (Ranking) rankingList.get(0);

	int minScaleRatio = (int) Math.floor(1.0 / pageRankMin.rankScore);
	int maxScaleRatio = (int) Math.floor(1.0 / pageRankMax.rankScore);

	if (fixAxes) {
		mNodeSizePageRankSlider.setMaximum(minScaleRatio * 30);
		mNodeSizePageRankSlider.setMinimum(maxScaleRatio * 10);
	}

	//Ranking min = (Ranking) rankingList.get(rankingList.size()-1);
	//		ChangeListener[] l =
	// mNodeAcceptBetweennessSlider.getChangeListeners();
	//		for (int i = 0; i < l.length; i++) {
	//			mNodeAcceptBetweennessSlider.removeChangeListener(l[i]);
	//		}

	if (fixAxes) {
		mNodeAcceptBetweennessSlider.setMaximum(
			(int) Math.ceil(betwennessMax.rankScore / 4.0));
		mNodeAcceptBetweennessSlider.setMinimum(1);
	}
	//		for (int i = 0; i < l.length; i++) {
	//			mNodeAcceptBetweennessSlider.addChangeListener(l[i]);
	//		}

	minScaleRatio = (int) Math.floor(1.0 / degreeMin.rankScore);
	maxScaleRatio = (int) Math.floor(1.0 / degreeMax.rankScore);

	if (fixAxes) {
		mNodeSizeDegreeSlider.setMaximum(minScaleRatio * 15);
		mNodeSizeDegreeSlider.setMinimum(maxScaleRatio * 5);
	}
	mVizViewer.revalidate();
	mVizViewer.repaint();

}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:65,代码来源:RankingDemo.java


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