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


Java PajekNetReader类代码示例

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


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

示例1: load

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
public void load(File netFile){
	VertexFactory vertexFactory = new VertexFactory();
	EdgeFactory edgeFactory = new EdgeFactory();
	
	PajekNetReader<PajekNetwork, Vertex, Edge> pReader = new PajekNetReader<PajekNetwork, Vertex, Edge>(vertexFactory, edgeFactory);
	try {
		pReader.load(netFile.getAbsolutePath(), this);
	} catch (IOException ioEx) {
		JOptionPane.showMessageDialog(null,ioEx.getMessage(),"Error",JOptionPane.ERROR_MESSAGE);
		System.err.println("Input error in Pajek file");
		ioEx.printStackTrace();
	}
	
	for (Vertex v : getVertices())
		v.setLabel(pReader.getVertexLabeller().transform(v));

	if (pReader.getEdgeWeightTransformer() != null)
		for (Edge e : getEdges())
			if (pReader.getEdgeWeightTransformer().transform(e) != null)
				e.setWeight(pReader.getEdgeWeightTransformer().transform(e).doubleValue());
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:22,代码来源:PajekNetwork.java

示例2: main

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
public static void main(String[] args) throws IOException, UniqueLabelException {

		JFrame jf = new JFrame("Scott's Toy Network Viewer");

//		PajekNetFile file = new PajekNetFile();
//		file.setCreateDirectedOnly(true);
//		Graph g = file.load("samples/datasets/smyth.net");
		PajekNetReader pnr = new PajekNetReader(true);
        Graph ug = pnr.load("samples/datasets/smyth.net", new SparseGraph());
        Graph g = DirectionTransformer.toDirected(ug);
        GraphUtils.copyLabels(StringLabeller.getLabeller(ug, PajekNetReader.LABEL),
            StringLabeller.getLabeller(g, PajekNetReader.LABEL));

		RankingDemo vizApp = new RankingDemo(g);
		jf.getContentPane().add(vizApp);
		jf.setSize(700, 500);
		jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		jf.pack();
		jf.setVisible(true);

	}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:23,代码来源:RankingDemo.java

示例3: RankingDemo

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
public RankingDemo(Graph g) throws HeadlessException {

		initialize();
		displayGraph(g);

		mLabel = "P Smyth";

		Vertex start =
			StringLabeller.getLabeller(mCurrentGraph, PajekNetReader.LABEL).getVertex(mLabel);
//          StringLabeller.getLabeller(mCurrentGraph).getVertex(mLabel);
		recalculate(g, start, true);
	}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:13,代码来源:RankingDemo.java

示例4: start

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
public void start() {
		System.out.println("Starting in applet mode.");
		InputStream is =
			this.getClass().getClassLoader().getResourceAsStream(
				"samples/datasets/smyth.net");
		BufferedReader br = new BufferedReader(new InputStreamReader(is));

		PajekNetReader pnr = new PajekNetReader(true);
        try
        {
            Graph ug = pnr.load(br, new SparseGraph());
            Graph g = DirectionTransformer.toDirected(ug);
            GraphUtils.copyLabels(StringLabeller.getLabeller(ug, PajekNetReader.LABEL),
                StringLabeller.getLabeller(g, PajekNetReader.LABEL));
//            Graph g = pnr.load(br, new UndirectedSparseGraph());
            RankingDemo vizApp = new RankingDemo(g);
            getContentPane().add(vizApp);
        }
        catch (IOException e)
        {
            System.out.println("Error in loading graph");
            e.printStackTrace();
        }
        catch (UniqueLabelException ule)
        {
            System.out.println("Unexpected duplicate label");
            ule.printStackTrace();
        }
	}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:30,代码来源:RankingDemoDriver.java

示例5: getGraph

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
/**
 * Generates a graph: in this case, reads it from the file
 * "samples/datasetsgraph/simple.net"
 * @return A sample undirected graph
 */
public static Graph getGraph() throws IOException 
{
    PajekNetReader pnr = new PajekNetReader(FactoryUtils.instantiateFactory(Object.class));
    Graph g = new UndirectedSparseGraph();
    
    pnr.load("src/main/resources/datasets/simple.net", g);
    return g;
}
 
开发者ID:marcvanzee,项目名称:mdp-plan-revision,代码行数:14,代码来源:SimpleGraphDraw.java

示例6: loadGraph

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
private void loadGraph()
{
   	// Our graph
    sequenceGraph = new UndirectedSparseGraph<Vertex, Edge>();
       
       // Will Create and load the vertex/edge created with the factory
       PajekNetReader<Graph<Vertex, Edge>, Vertex, Edge> fileReader = new PajekNetReader<Graph<Vertex, Edge>, Vertex, Edge>(Vertex.getFactory(), Edge.getFactory());
       
       fileReader.setVertexLabeller(new MapSettableTransformer<Vertex, String>(new HashMap<Vertex, String>()));
       fileReader.setEdgeWeightTransformer(new MapSettableTransformer<Edge, Number>(new HashMap<Edge, Number>()));
       
       try {
           fileReader.load("/home/etienne/__A__/Dev/Reidentification/Data/OutputReid/network.net", sequenceGraph);
       } catch (IOException e) {
           System.err.println("Cannot load the network file");
           e.printStackTrace();
       }

	for (Vertex node : sequenceGraph.getVertices())
	{
		node.setLabel(fileReader.getVertexLabeller().transform(node));
	}
	
	for (Edge edge : sequenceGraph.getEdges())
	{
		edge.setWeight(fileReader.getEdgeWeightTransformer().transform(edge).floatValue());
	}
}
 
开发者ID:Conchylicultor,项目名称:NetworkVisualizer,代码行数:29,代码来源:VisualizerWindow.java

示例7: getGraph

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
public static Graph getGraph(String FileName) throws IOException
{
    PajekNetReader pnr = new PajekNetReader(FactoryUtils.instantiateFactory(Object.class));
    Graph g = new UndirectedSparseGraph();

    pnr.load(FileName, g);
    return g;
}
 
开发者ID:nilizadeh,项目名称:de-anonymization,代码行数:9,代码来源:MyGraph.java

示例8: getGraph

import edu.uci.ics.jung.io.PajekNetReader; //导入依赖的package包/类
/**
 * Generates a graph: in this case, reads it from the file
 * "samples/datasetsgraph/simple.net"
 * @return A sample undirected graph
 */
public static Graph getGraph() throws IOException {
       PajekNetReader pnr = new PajekNetReader();
       Graph g = pnr.load("samples/datasets/simple.net");
	return g;
}
 
开发者ID:dev-cuttlefish,项目名称:cuttlefish,代码行数:11,代码来源:SimpleGraphDraw.java


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