當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。