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


Java Graph.addAttribute方法代码示例

本文整理汇总了Java中org.graphstream.graph.Graph.addAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Graph.addAttribute方法的具体用法?Java Graph.addAttribute怎么用?Java Graph.addAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.graphstream.graph.Graph的用法示例。


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

示例1: generateGraph

import org.graphstream.graph.Graph; //导入方法依赖的package包/类
/**
 * Random seed taken for simulator: for each seed the same barabasi network
 * is generated with getMaxLinkPerNode and getNumUsers nodes
 */
public static Graph generateGraph(long seedNetwork, int maxLinkPerNode, int nodes) {
    System.setProperty("org.graphstream.ui.renderer",
            "org.graphstream.ui.j2dviewer.J2DGraphRenderer");
    Graph graph = new SingleGraph("Social network");
    String path = (new File(BTSim.getProperty("graphStylePath"))).getAbsolutePath();
    graph.addAttribute("ui.stylesheet", "url('" + path + "')");  //style of graph
    // Between 1 and maxLinkPerNode new links per node added.

    Generator gen = new BarabasiAlbertGenerator(maxLinkPerNode);
    // Generate numUsers nodes:

    ((BaseGenerator) gen).setRandomSeed(seedNetwork);

    gen.addSink(graph);
    gen.begin();
    for (int i = 0; i < nodes - 2; i++) {//barabasi starts with 2 agents
        gen.nextEvents();
    }
    //gen.end(); //to add more nodes
    return graph;
  //  graphGenerator = gen;

}
 
开发者ID:gsi-upm,项目名称:BigTweet,代码行数:28,代码来源:GraphTools.java

示例2: createGraph

import org.graphstream.graph.Graph; //导入方法依赖的package包/类
private Graph createGraph() {
	Graph graph = new MultiGraph("Traversal");
	graph.addAttribute("ui.quality");
	graph.addAttribute("ui.antialias");
	graph.addAttribute("ui.stylesheet", styleSheet);

	return graph;
}
 
开发者ID:enijkamp,项目名称:supermonkey,代码行数:9,代码来源:TraversalViewer.java

示例3: createSingleGraph

import org.graphstream.graph.Graph; //导入方法依赖的package包/类
private Graph createSingleGraph(String graphId) {
	Graph gr = new SingleGraph(graphId);
	gr.setStrict(false);
	gr.addAttribute("ui.stylesheet", GraphPartitionator.STYLESHEET);
	return gr;
}
 
开发者ID:isislab-unisa,项目名称:streaminggraphpartitioning,代码行数:7,代码来源:StreamingGraphPartitionator.java

示例4: execute

import org.graphstream.graph.Graph; //导入方法依赖的package包/类
public void execute() {
		// Toolkit.c
		final Graph graph = new SingleGraph("roberto");
		graph.setStrict(false);
		graph.addAttribute("ui.stylesheet", "node.important {fill-color: red;}");
		graph.addAttribute("ui.quality");
		graph.addAttribute("ui.antialias");

		BaseGenerator gen = null;

		// Between 1 and 3 new links per node added.
		// gen = new BarabasiAlbertGenerator(1);//talvez
		// gen = new DorogovtsevMendesGenerator();//talvez

		// gen = new PointsOfInterestGenerator();//gera desconexo
		// gen = new PreferentialAttachmentGenerator();//parece com lobster
		// gen = new RandomEuclideanGenerator(2);//+-
		// gen = new RandomFixedDegreeDynamicGraphGenerator(200, 9.0,
		// 0.5);//acho que não
		// gen = new WattsStrogatzGenerator(200, 4, 0.1);//+-

		// gen = new ClusterGeneratorOld(200);

		int n = 100;
		// gen = new LobsterGenerator(5, 5);// sim
		// gen = new CustomLobsterGenerator(500, 3, 5);// sim
		// gen = new CustomFlowerSnarkGenerator(100);//sim
//		 gen = new ClusterGenerator(n, 3, 3); //sim
		// gen = new CustomGridGenerator(110, true, 0.9F, 15, 5);//usado para
		// gen = new WattsStrogatzGenerator(20, 10, 0.1);//pode ser mas tem que
		// rodar 2 vezes

		// gen = new BarabasiAlbertGenerator(1);//talvez - parecido com lobster
		// gen = new DorogovtsevMendesGenerator();//talvez

		gen.setRandomSeed(12345);
		gen.addSink(graph);
		gen.begin();
		while (gen.nextEvents())
			;
		gen.end();
		System.out.println("" + graph.getNodeCount() + " " + graph.getEdgeCount());

		// gen.configureNodes(graph);
		// System.out.println("Amount of important: " + gen.countImportant);

		Viewer viewer = graph.display(true);
		// Layout layoutAlgorithm = new SpringBox();
		// viewer.enableAutoLayout(layoutAlgorithm);
		viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.HIDE_ONLY);

		ViewerListener vl = new MyViewListener(graph, n, 2, gen);
		ViewerPipe fromViewer = viewer.newViewerPipe();
		fromViewer.addViewerListener(vl);
		fromViewer.addSink(graph);

		while (loop) {
			fromViewer.pump(); // or fromViewer.blockingPump();

			try {
				Thread.sleep(100);
			} catch (InterruptedException e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		}

		// try {
		// Thread.sleep(10000);
		// } catch (InterruptedException e1) {
		// // TODO Auto-generated catch block
		// e1.printStackTrace();
		// }
	}
 
开发者ID:rrocharoberto,项目名称:GraphPartitionFramework,代码行数:75,代码来源:CopyOfGeneratorTestOld.java

示例5: execute

import org.graphstream.graph.Graph; //导入方法依赖的package包/类
public void execute(int k, int n) {
	// Toolkit.c
	final Graph graph = new SingleGraph("roberto");
	graph.setStrict(false);
	graph.addAttribute("ui.stylesheet", "node.important {fill-color: red;}");
	graph.addAttribute("ui.quality");
	graph.addAttribute("ui.antialias");

	BaseGenerator gen = null;

	// Between 1 and 3 new links per node added.
	// gen = new BarabasiAlbertGenerator(1);//talvez
	// gen = new DorogovtsevMendesGenerator();//talvez

	// gen = new PointsOfInterestGenerator();//gera desconexo
	// gen = new PreferentialAttachmentGenerator();//parece com lobster
	// gen = new RandomEuclideanGenerator(2);//+-
	// gen = new RandomFixedDegreeDynamicGraphGenerator(200, 9.0,
	// 0.5);//acho que não
	// gen = new WattsStrogatzGenerator(200, 4, 0.1);//+-

	// gen = new ClusterGeneratorOld(200);

	int minDegree = 3;
	int maxDegree = 6;
	// gen = new ClusterGenerator(n, minDegree, maxDegree, k); // sim
	// gen = new CustomGridGenerator(n, true, 0.9F, 15, 5);//usado para

	// gen = new LobsterGenerator(5, 5);// sim
	// gen = new CustomLobsterGenerator(n, 3, 5);// sim
	gen = new CustomFlowerSnarkGenerator(n);// sim
	// gen = new WattsStrogatzGenerator(20, 10, 0.1);//pode ser mas tem que
	// rodar 2 vezes

	// gen = new BarabasiAlbertGenerator(1);//talvez - parecido com lobster
	// gen = new DorogovtsevMendesGenerator();//talvez

	gen.setRandomSeed(12345);
	gen.addSink(graph);
	gen.begin();
	while (gen.nextEvents())
		;
	gen.end();
	System.out.println("" + graph.getNodeCount() + " " + graph.getEdgeCount());

	// gen.configureNodes(graph);
	// System.out.println("Amount of important: " + gen.countImportant);

	// Layout layoutAlgorithm = new SpringBox();
	// viewer.enableAutoLayout(layoutAlgorithm);

	ViewerListener vl = new MyViewListener(graph, n, k, gen);
	// vl.viewClosed("any");

	Viewer viewer = graph.display(true);
	viewer.setCloseFramePolicy(Viewer.CloseFramePolicy.HIDE_ONLY);

	ViewerPipe fromViewer = viewer.newViewerPipe();
	fromViewer.addViewerListener(vl);
	fromViewer.addSink(graph);

	while (true) {
		fromViewer.pump(); // or fromViewer.blockingPump();

		try {
			Thread.sleep(200);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
	}

}
 
开发者ID:rrocharoberto,项目名称:GraphPartitionFramework,代码行数:73,代码来源:GeneratorMain.java


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