• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VertexFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: generateCompleteGraph

import org.jgrapht.VertexFactory; //导入依赖的package包/类
private Graph<AutomatVertex, DefaultEdge> generateCompleteGraph(int size) {
    LOG.info("--- generateCompleteGraph ---");

    //Create the CompleteGraphGenerator object
    final Graph<AutomatVertex, DefaultEdge> completeGraph = new SimpleGraph<>(DefaultEdge.class);
    final CompleteGraphGenerator<AutomatVertex, DefaultEdge> completeGenerator = new CompleteGraphGenerator<>(size);

    //Create the VertexFactory so the generator can create vertices
    final VertexFactory<AutomatVertex> vFactory = new ClassBasedVertexFactory<>(AutomatVertex.class);

    LOG.info("Generating complete graph");

    //Use the CompleteGraphGenerator object to make completeGraph a
    //complete graph with [size] number of vertices
    completeGenerator.generateGraph(completeGraph, vFactory, null);
    return completeGraph;
}
 
开发者ID:bedla,项目名称:parkovani-v-praze,代码行数:18,代码来源:GraphDataLoaderController.java


示例2: nonPlanarRandomGraphStructure

import org.jgrapht.VertexFactory; //导入依赖的package包/类
/**
 * Creates a naive, random, not necessarily planar graph
 */
@Deprecated
public static UndirectedGraph<RegionSetup, DefaultEdge> nonPlanarRandomGraphStructure(
        final double populationPerRegionMean,
        final double populationStandardDeviation,
        UniformDistributionRNG rng,
        IntegerInterval numberOfRegionsInterval,
        IntegerInterval averageAdjacenciesPerRegionInterval
) {
    int numberOfRegions = rng.nextInt(numberOfRegionsInterval);
    int numberOfAdjacencies = rng.nextInt(averageAdjacenciesPerRegionInterval) * numberOfRegions;
    RandomGraphGenerator<RegionSetup, DefaultEdge> randomGraphGenerator = new RandomGraphGenerator<>(
            numberOfRegions, numberOfAdjacencies, rng.nextLong());
    SimpleGraph<RegionSetup, DefaultEdge> targetGraph = new SimpleGraph<>(DefaultEdge.class);
    VertexFactory<RegionSetup> vertexFactory = () -> new RegionSetup(populationPerRegionMean, populationStandardDeviation, "randomly created");
    randomGraphGenerator.generateGraph(targetGraph, vertexFactory, null);
    return targetGraph;
}
 
开发者ID:spectrumauctions,项目名称:sats-core,代码行数:21,代码来源:MRVMWorldSetup.java


示例3: testCutCyclesCompleteGraph

import org.jgrapht.VertexFactory; //导入依赖的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: generateGraph

import org.jgrapht.VertexFactory; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void generateGraph(
        Graph<V, E> target,
        VertexFactory<V> vertexFactory,
        Map<String, V> resultMap)
{
    final int size = readNodeCount();
    if (resultMap == null) {
        resultMap = new HashMap<>();
    }

    for (int i = 0; i < size; i++) {
        V newVertex = vertexFactory.createVertex();
        target.addVertex(newVertex);
        resultMap.put(Integer.toString(i + 1), newVertex);
    }
    String[] cols = skipComments();
    while (cols != null) {
        if (cols[0].equals("e")) {
            E edge = target
                    .addEdge(resultMap.get(cols[1]), resultMap.get(cols[2]));
            if (target instanceof WeightedGraph && (edge != null)) {
                double weight = defaultWeight;
                if (cols.length > 3) {
                    weight = Double.parseDouble(cols[3]);
                }
                ((WeightedGraph<V, E>) target).setEdgeWeight(edge, weight);
            }
        }
        cols = skipComments();
    }
}
 
开发者ID:coin-or,项目名称:jorlib,代码行数:36,代码来源:DIMACSImporter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SortRowsMeta类代码示例发布时间:2022-05-22
下一篇:
Java SearchShardTarget类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap