org.jgrapht.Graph.getEdgeFactory()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.jgrapht.Graph.getEdgeFactory()方法的一些代码示例,展示了Graph.getEdgeFactory()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getEdgeFactory()方法的具体详情如下:
包路径:org.jgrapht.Graph
类名称:Graph
方法名:getEdgeFactory

Graph.getEdgeFactory介绍

[英]Returns the edge factory using which this graph creates new edges. The edge factory is defined when the graph is constructed and must not be modified.
[中]返回此图形用于创建新边的边工厂。边工厂是在构造图时定义的,不能修改。

代码示例

代码示例来源:origin: rohanpadhye/jqf

EdgeFactory<V, E> edgeFactory = graph.getEdgeFactory();
Map<E, V> sources = new HashMap<>();
Map<E, V> targets = new HashMap<>();

代码示例来源:origin: org.orbisgis/java-network-analyzer

@Override
public TraversalGraph<V, E> reconstructTraversalGraph() {
  if (currentStartNode == null) {
    throw new IllegalStateException("You must call #calculate before " +
        "reconstructing the traversal graph.");
  }
  TraversalGraph<V, E> traversalGraph = new TraversalGraph<V, E>(
      graph.getEdgeFactory(), currentStartNode);
  for (V v : graph.vertexSet()) {
    Set<E> predEdges = (Set<E>) v.getPredecessorEdges();
    for (E e : predEdges) {
      V source = graph.getEdgeSource(e);
      V target = graph.getEdgeTarget(e);
      traversalGraph.addVertex(source);
      traversalGraph.addVertex(target);
      if (v.equals(source)) {
        traversalGraph.addEdge(target, source).setBaseGraphEdge(e);
      } else if (v.equals(target)) {
        traversalGraph.addEdge(source, target).setBaseGraphEdge(e);
      } else {
        throw new IllegalStateException("A vertex has a predecessor " +
            "edge not ending on itself.");
      }
    }
  }
  return traversalGraph;
}

代码示例来源:origin: org.orbisgis/java-network-analyzer

graph.getEdgeFactory(), currentStartNode);
for (V v : graph.vertexSet()) {
  Set<E> predEdges = (Set<E>) v.getPredecessorEdges();

相关文章