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


Java IEdge类代码示例

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


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

示例1: connected

import mulavito.graph.IEdge; //导入依赖的package包/类
/**
 * Test whether a graph is connected.
 * 
 * @param graph to test.
 * @return true if graph is connected, false otherwise.
 */
public static boolean connected(Graph<IVertex, IEdge> graph) {
	DijkstraShortestPath<IVertex, IEdge> sp = new DijkstraShortestPath<>(graph);
	Collection<IVertex> verts = graph.getVertices();

	// forall vertA, vertB in graph exists connecting path <=> graph is connected
	for (IVertex vertA : verts) {
		for (IVertex vertB : verts) {
			if (sp.getDistance(vertA, vertB) == null) {
				return false;
			}
		}
	}

	return true;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:22,代码来源:GraphMetrics.java

示例2: summarize

import mulavito.graph.IEdge; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
public String summarize(NetworkStack stack) {
	StringBuilder summary = new StringBuilder();
	summary.append(this.getSummaryTitle() + "\n");
	for (Network n : stack) {
		if (n instanceof SubstrateNetwork) {
			summary.append(" Substrate: " + this.evaluateGraph((Graph<IVertex, IEdge>) n) + "\n");
		} else if (n instanceof VirtualNetwork) {
			summary.append(" Virtual: " + this.evaluateGraph((Graph<IVertex, IEdge>) n) + "\n");
		} else {
			throw new RuntimeException("Cannot summarize unknown network: " + n.toString());
		}
	}
	return summary.toString();
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:16,代码来源:StackSummarizer.java

示例3: outdegreeDistribution

import mulavito.graph.IEdge; //导入依赖的package包/类
/**
 * Determine the outdegree distribution of a graph.
 * 
 * @param graph
 *            to analyze.
 * @return a map with the outdegree as keys and the number of nodes with
 *         this outdegree as the corresponding value.
 */
public static Map<Integer,Integer> outdegreeDistribution(Graph<IVertex, IEdge> graph) {
	Map<Integer, Integer> result = new HashMap<Integer, Integer>();
	Collection<IVertex> verts = graph.getVertices();
	for (IVertex vertex : verts) {
		int outdegree = graph.getOutEdges(vertex).size();
		Integer cnt = result.get(outdegree);
		cnt = (cnt == null) ? 0 : cnt;
		cnt++;
		result.put(outdegree, cnt);
	}
	return result;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:21,代码来源:GraphMetrics.java

示例4: evaluateGraph

import mulavito.graph.IEdge; //导入依赖的package包/类
@Override
protected String evaluateGraph(Graph<IVertex, IEdge> graph) {
	return GraphMetrics.outdegreeDistribution(graph).toString();
}
 
开发者ID:fabe85,项目名称:Alevin,代码行数:5,代码来源:NewTopologiesExperimentRig.java

示例5: evaluateGraph

import mulavito.graph.IEdge; //导入依赖的package包/类
protected abstract String evaluateGraph(Graph<IVertex, IEdge> graph); 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:2,代码来源:StackSummarizer.java


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