本文整理汇总了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;
}
示例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();
}
示例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;
}
示例4: evaluateGraph
import mulavito.graph.IEdge; //导入依赖的package包/类
@Override
protected String evaluateGraph(Graph<IVertex, IEdge> graph) {
return GraphMetrics.outdegreeDistribution(graph).toString();
}
示例5: evaluateGraph
import mulavito.graph.IEdge; //导入依赖的package包/类
protected abstract String evaluateGraph(Graph<IVertex, IEdge> graph);