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


Java UndirectedSparseMultigraph类代码示例

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


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

示例1: createGraphViewerPanelManager

import edu.uci.ics.jung.graph.UndirectedSparseMultigraph; //导入依赖的package包/类
public GraphViewerPanelManager createGraphViewerPanelManager(TopologyManagerFrame topologyManagerFrame,
                                                             String graphType,
                                                             String projectType,
                                                             TopologyViewerConfigManager viewerConfig,
                                                             File selectedFile,
                                                             File path,
                                                             JTabbedPane tabbedPane) throws Exception {
    if (graphType.equals("undirected")) {
        logger.info("Opening "+ projectType + " with viewer config" + viewerConfig + "and selected file" + selectedFile);
        return
                new GraphViewerPanelManager<UndirectedGraph<String, String>>(
                        topologyManagerFrame,
                        projectType,
                        path,
                        viewerConfig,
                        selectedFile,
                        UndirectedSparseMultigraph.<String, String>getFactory(),
                        tabbedPane,
                        GraphType.UNDIRECTED,
                        graphViewerPanelFactory);
    } else if (selectedFile.getAbsolutePath().contains("directed")) {

        return
                new GraphViewerPanelManager<DirectedGraph<String, String>>(
                        topologyManagerFrame,
                        projectType,
                        path,
                        viewerConfig,
                        selectedFile,
                        DirectedSparseMultigraph.<String, String>getFactory(),
                        tabbedPane,
                        GraphType.DIRECTED,
                        graphViewerPanelFactory);
    } else {
        throw new RuntimeException(String.format("Unknown graph type %s. Expected types are (directed, undirected)", selectedFile.getName()));
    }

}
 
开发者ID:iTransformers,项目名称:netTransformer,代码行数:39,代码来源:GraphViewerPanelManagerFactory.java

示例2: createTestGraph

import edu.uci.ics.jung.graph.UndirectedSparseMultigraph; //导入依赖的package包/类
/**
 * Creates a small sample graph that can be used for testing purposes. The
 * graph is as described in the section on {@link #pairs pairs}. If <code>isDirected</code>,
 * the graph is a {@link DirectedSparseMultigraph DirectedSparseMultigraph},
 * otherwise, it is an {@link UndirectedSparseMultigraph UndirectedSparseMultigraph}.
 * 
 * @return a graph consisting of eight edges and ten nodes.
 */
public static Graph<String, Number> createTestGraph(boolean directed) {
	Graph<String, Number> graph = null;
	if(directed) {
		graph = new DirectedSparseMultigraph<String,Number>();
	} else {
		graph = new UndirectedSparseMultigraph<String,Number>();
	}

	for (int i = 0; i < pairs.length; i++) {
		String[] pair = pairs[i];
		graph.addEdge(Integer.parseInt(pair[2]), pair[0], pair[1]);
	}
	return graph;
}
 
开发者ID:SiLeBAT,项目名称:BfROpenLab,代码行数:23,代码来源:TestGraphs.java


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