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


Java EdgeFactory类代码示例

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


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

示例1: match

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
static KuhnMunkresMinimalWeightBipartitePerfectMatching<V, WeightedEdge>
    match(final double[][] costMatrix, final int partitionCardinality) {

    List<? extends V> first     = firstPartition.subList(0, partitionCardinality);
    List<? extends V> second    = secondPartition.subList(0, partitionCardinality);

    WeightedGraph<V, WeightedEdge> target =
      new SimpleWeightedGraph<V, WeightedEdge>(new EdgeFactory<V, WeightedEdge>() {
        @Override
        public WeightedEdge createEdge(V sourceVertex, V targetVertex) {
          return WeightedEdge.make(sourceVertex, targetVertex);
        }
      });

    WeightedGraphGeneratorAdapter<V, WeightedEdge, V> generator =
      new SimpleWeightedBipartiteGraphMatrixGenerator<V, WeightedEdge>()
          .first  (first)
          .second (second)
          .weights(costMatrix);

    generator.generateGraph(target, null, null);

    return new KuhnMunkresMinimalWeightBipartitePerfectMatching<V, WeightedEdge>(target, first, second);

}
 
开发者ID:j123b567,项目名称:stack-usage,代码行数:26,代码来源:KuhnMunkresMinimalWeightBipartitePerfectMatchingTest.java

示例2: testAddEdgeWithMissingVertices

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@Test
public void testAddEdgeWithMissingVertices() {
	Graph<String, String> graph = new DefaultDirectedGraph<>(new EdgeFactory<String, String>() {
		public String createEdge(String sourceVertex, String targetVertex) {
			return sourceVertex + targetVertex;
		};
	});
	graph = new AddVerticesAutomatically<>(graph);
	graph.addEdge("A", "B");
	graph.addEdge("A", "C", "DEF");
	assertTrue(graph.containsVertex("A"));
	assertTrue(graph.containsVertex("B"));
	assertTrue(graph.containsVertex("C"));
	assertTrue(graph.containsEdge("AB"));
	assertTrue(graph.containsEdge("DEF"));
}
 
开发者ID:andreasbehnke,项目名称:javaan,代码行数:17,代码来源:TestAddVerticesAutomatically.java

示例3: testCutCyclesCompleteGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@Test
public void testCutCyclesCompleteGraph() throws IOException {
	CompleteGraphGenerator<String, String> generator = new CompleteGraphGenerator<>(5);
	DirectedGraph<String, String> graph = new DefaultDirectedGraph<>(new EdgeFactory<String, String>() {
		@Override
		public String createEdge(String sourceVertex, String targetVertex) {
			return sourceVertex + targetVertex;
		}
	});
	generator.generateGraph(graph, new VertexFactory<String>() {
		
		private int count = 0;
		
		@Override
		public String createVertex() {
			count ++;
			return "V" + count;
		}
	}, new HashMap<String, String>());
	DirectedGraph<String, String> target = new DefaultDirectedGraph<>(new UnsupportedEdgeFactory<String, String>());
	target = new MinimumEdgesCycleCut<String, String>(graph, target).cutCycles();
}
 
开发者ID:andreasbehnke,项目名称:javaan,代码行数:23,代码来源:TestMinimumEdgesCycleCut.java

示例4: BaseGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
/**
 * Construct a TestGraph with kmerSize
 * @param kmerSize
 */
public BaseGraph(final int kmerSize, final EdgeFactory<V,E> edgeFactory) {
    super(edgeFactory);

    if ( kmerSize < 1 ) throw new IllegalArgumentException("kmerSize must be >= 1 but got " + kmerSize);
    this.kmerSize = kmerSize;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:11,代码来源:BaseGraph.java

示例5: TrafficLocationGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
private TrafficLocationGraph()
{
	EdgeFactory<Integer, LocationEdge> ef = new EdgeFactory<Integer, TrafficLocationGraph.LocationEdge>() {
		
		@Override
		public LocationEdge createEdge(Integer sourceVertex, Integer targetVertex) {
			// TODO Auto-generated method stub
			return new LocationEdge(sourceVertex, targetVertex);
		}
	};
	graph = new DefaultDirectedGraph<Integer, LocationEdge>(ef);
}
 
开发者ID:GIScience,项目名称:openrouteservice,代码行数:13,代码来源:TrafficLocationGraph.java

示例6: createMetricClosure

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
/**
   * Computes the metric closure with a given set of vertices over a graph.
   * @param originalGraph The Graph over which the metric closure should be computed.
   * @param destinations A set of vertices which should exist in the metric closure.
   * @return A Graph that uses MetricClosureEdgeAnnotations that store the paths in the original graph to allow later reconstruction.
   */
public static <T, E> DirectedWeightedPseudograph<T, MetricClosureEdge<T>> createMetricClosure(DirectedWeightedPseudograph<T, E> originalGraph, Set<T> destinations) {
	DirectedWeightedPseudograph<T, MetricClosureEdge<T>> metricClosure = new DirectedWeightedPseudograph<>(new EdgeFactory<T, MetricClosureEdge<T>>() {
		@Override
		public MetricClosureEdge<T> createEdge(T sourceVertex, T targetVertex) {
			return new MetricClosureEdge<>(new ArrayList<T>());
		}
	});
	
	for (E edge : originalGraph.edgeSet()) {
		T start = originalGraph.getEdgeSource(edge);
		T end = originalGraph.getEdgeTarget(edge);
		
		metricClosure.addVertex(start);
		metricClosure.addVertex(end);
		MetricClosureEdge<T> newEdge = metricClosure.addEdge(start, end);
		double edgeWeight = originalGraph.getEdgeWeight(edge);
		metricClosure.setEdgeWeight(newEdge, edgeWeight);
	}
	
	Set<T> removedVertices = new HashSet<T>(originalGraph.vertexSet());
	removedVertices.removeAll(destinations);
	
	for (T removedVertex : removedVertices) {
		eliminateVertex(metricClosure, removedVertex);
	}
	
	return metricClosure;
}
 
开发者ID:ls1intum,项目名称:jReto,代码行数:35,代码来源:MinimumSteinerTreeApproximation.java

示例7: TestDigraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
public TestDigraph(EdgeFactory<DiNode, DiEdge> arg0) {
	super(arg0, true, true);
}
 
开发者ID:FINRAOS,项目名称:JTAF-XCore,代码行数:4,代码来源:TestDigraph.java

示例8: constructDirectedGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
private DirectedGraph<AbstractProject<?,?>, String> constructDirectedGraph(AbstractProject<?,?> root, Set<String> exclusions) {
    final DirectedGraph<AbstractProject<?,?>, String> graph = new DefaultDirectedGraph<AbstractProject<?,?>, String>(
            new EdgeFactory<AbstractProject<?,?>, String>() {
                public String createEdge(AbstractProject<?,?> source, AbstractProject<?,?> target) {
                    return String.format("'%s' --> '%s'", source.getName(), target.getName());
                }
            });

    final StringBuilder prettyPrinter = new StringBuilder(); // Used for printing the pipeline graph as an adjacency list matrix.
    final Stack<AbstractProject<?,?>> stack = new Stack<AbstractProject<?,?>>();
    graph.addVertex(root);
    stack.push(root);
    while (!stack.isEmpty()) {
        final AbstractProject<?,?> p = stack.pop();
        prettyPrinter.append(p.getName());
        prettyPrinter.append(": {");
        int index = 0;
        final List<AbstractProject> children = p.getDownstreamProjects();
        for (AbstractProject<?,?> child : children) {
            if (!child.isDisabled() && !exclusions.contains(child.getName())) {
                graph.addVertex(child);
                graph.addEdge(p, child);
                stack.push(child);
                if (index > 0) {
                    prettyPrinter.append(", ");
                }
                prettyPrinter.append(child.getName());
                index++;
            }
        }
        prettyPrinter.append(String.format("}%n"));
    }

    if (verbose) {
        LOGGER.log(Level.INFO, String.format("The build pipeline graph rooted at '%s':%n%s", root.getName(), prettyPrinter.toString()));
    }

    return graph;
}
 
开发者ID:johnnymongiat,项目名称:pipeline-sink-trigger-plugin,代码行数:41,代码来源:BuildGraphPipelineSinkTrigger.java

示例9: getEdgeFactory

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@Override
public EdgeFactory<Node, Triple> getEdgeFactory() {
    return edgeFactory;
}
 
开发者ID:SmartDataAnalytics,项目名称:SubgraphIsomorphismIndex,代码行数:5,代码来源:PseudoGraphJenaGraph.java

示例10: getEdgeFactory

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@Override
public EdgeFactory<RDFNode, Statement> getEdgeFactory() {
    return edgeFactory;
}
 
开发者ID:SmartDataAnalytics,项目名称:SubgraphIsomorphismIndex,代码行数:5,代码来源:PseudoGraphJenaModel.java

示例11: StandardGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
public StandardGraph(EdgeFactory<V, E> edgeFactory)
{
	super(edgeFactory);
}
 
开发者ID:guilhermekrz,项目名称:JavaFF,代码行数:5,代码来源:StandardGraph.java

示例12: getEdgeFactory

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
public EdgeFactory<State, Transition> getEdgeFactory() {
    return delegate.getEdgeFactory();
}
 
开发者ID:julianthome,项目名称:autorex,代码行数:4,代码来源:AbstractGraph.java

示例13: GeneNetwork

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
GeneNetwork(EdgeFactory edgeFactory) {
    super(edgeFactory);
}
 
开发者ID:hyounesy,项目名称:ALEA,代码行数:4,代码来源:GeneNetwork.java

示例14: SimpleGraph

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
protected SimpleGraph(EdgeFactory<String, String> ef, boolean allowMultipleEdges, boolean allowLoops) {
	super(ef, allowMultipleEdges, allowLoops);
	// TODO Auto-generated constructor stub
}
 
开发者ID:alexejsailer,项目名称:FXGraphs,代码行数:5,代码来源:SimpleGraph.java

示例15: getEdgeFactory

import org.jgrapht.EdgeFactory; //导入依赖的package包/类
@Override
public EdgeFactory<Vertex, Edge> getEdgeFactory() {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:martinomburajr,项目名称:Siyavula-Bona-Java,代码行数:6,代码来源:Graph.java


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