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