可视化工具gephi源码探秘(二)---导入netbeans
1 package org.gephi; 2 3 import org.gephi.io.generator.plugin.DynamicGraph; 4 import org.gephi.io.generator.plugin.RandomGraph; 5 import org.gephi.io.importer.api.Container; 6 import org.gephi.io.importer.api.ContainerFactory; 7 import org.gephi.io.importer.api.ImportController; 8 import org.gephi.io.processor.plugin.AppendProcessor; 9 import org.gephi.io.processor.plugin.DefaultProcessor; 10 import org.gephi.project.api.ProjectController; 11 import org.gephi.project.api.Workspace; 12 import org.openide.util.Lookup; 13 14 public class GenerateGraph { 15 16 /** 17 * @param args 18 */ 19 public static void main(String[] args) { 20 21 //Init a project - and therefore a workspace 22 ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); 23 pc.newProject(); 24 Workspace workspace = pc.getCurrentWorkspace(); 25 26 //Generate a new random graph into a container 27 Container container = Lookup.getDefault().lookup(ContainerFactory.class).newContainer(); 28 RandomGraph randomGraph = new RandomGraph(); 29 randomGraph.setNumberOfNodes(500); 30 randomGraph.setWiringProbability(0.005); 31 randomGraph.generate(container.getLoader()); 32 33 //Append container to graph structure 34 ImportController importController = Lookup.getDefault().lookup(ImportController.class); 35 importController.process(container, new DefaultProcessor(), workspace); 36 37 //Generate another graph and append it to the current workspace 38 Container container2 = Lookup.getDefault().lookup(ContainerFactory.class).newContainer(); 39 RandomGraph randomGraph2 = new RandomGraph(); 40 randomGraph2.setNumberOfNodes(100); 41 randomGraph2.setWiringProbability(0.01); 42 randomGraph2.generate(container.getLoader()); 43 importController.process(container2, new AppendProcessor(), workspace); //Use AppendProcessor to append to current workspace 44 45 //Create new workspace 46 Workspace workspace2 = pc.newWorkspace(pc.getCurrentProject()); 47 pc.openWorkspace(workspace2); //Set as current workspace 48 49 //Generate dynamic graph into workspace 2 50 Container container3 = Lookup.getDefault().lookup(ContainerFactory.class).newContainer(); 51 52 DynamicGraph dynamicGraph = new DynamicGraph(); 53 dynamicGraph.generate(container3.getLoader()); 54 importController.process(container3, new DefaultProcessor(), workspace2); 55 56 } 57 58 59 }
成功运行后结果如下:
# Edges loaded: 578
# New Nodes appended: 0
# New Edges appended: 0
# Nodes loaded: 50
# Edges loaded: 47
Using harness folder F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources/platform/harness
branding:
files-init:
release:
build:
org.gephi.desktop.mrufiles.api.taskdefs:
org.gephi.desktop.mrufiles.api.common-init:
org.gephi.desktop.mrufiles.api.projectized-common.basic-init:
org.gephi.desktop.mrufiles.api.basic-init:
org.gephi.desktop.mrufiles.api.files-init:
org.gephi.desktop.mrufiles.api.nbm-license-init:
org.gephi.desktop.mrufiles.api.build-init:
Scanning for modules in F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources\platform\platform
Scanning for modules in suite F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources
org.gephi.desktop.mrufiles.api.init:
org.gephi.desktop.mrufiles.api.up-to-date:
org.gephi.desktop.mrufiles.api.compile:
org.gephi.desktop.mrufiles.api.jar-prep:
org.gephi.desktop.mrufiles.api.jar:
org.gephi.desktop.mrufiles.api.netbeans-extra:
org.gephi.desktop.mrufiles.api.javahelp:
org.gephi.desktop.mrufiles.api.module-auto-deps:
org.gephi.desktop.mrufiles.api.release:
org.gephi.desktop.mrufiles.api.module-xml-regular:
org.gephi.desktop.mrufiles.api.module-xml-autoload:
org.gephi.desktop.mrufiles.api.module-xml-eager:
org.gephi.desktop.mrufiles.api.chmod-executables:
org.gephi.desktop.mrufiles.api.verify-class-linkage:
0 file(s) have been successfully validated.
org.gephi.desktop.mrufiles.api.netbeans:
Generating information for Auto Update...
org.gephi.io.database.drivers.taskdefs:
org.gephi.io.database.drivers.common-init:
org.gephi.io.database.drivers.projectized-common.basic-init:
org.gephi.io.database.drivers.basic-init:
org.gephi.io.database.drivers.files-init:
org.gephi.io.database.drivers.nbm-license-init:
org.gephi.io.database.drivers.build-init:
Scanning for modules in F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources\platform\platform
Scanning for modules in suite F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources
org.gephi.io.database.drivers.init:
org.gephi.io.database.drivers.up-to-date:
org.gephi.io.database.drivers.compile:
org.gephi.io.database.drivers.jar-prep:
org.gephi.io.database.drivers.jar:
org.gephi.io.database.drivers.netbeans-extra:
org.gephi.io.database.drivers.javahelp:
org.gephi.io.database.drivers.module-auto-deps:
org.gephi.io.database.drivers.release:
Copying 6 files to F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources\build\cluster
org.gephi.io.database.drivers.module-xml-regular:
……
org.gephi.desktop.timeline.taskdefs:
org.gephi.desktop.timeline.common-init:
org.gephi.desktop.timeline.projectized-common.basic-init:
org.gephi.desktop.timeline.basic-init:
org.gephi.desktop.timeline.files-init:
org.gephi.desktop.timeline.nbm-license-init:
org.gephi.desktop.timeline.build-init:
Scanning for modules in F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources\platform\platform
Scanning for modules in suite F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources
org.gephi.desktop.timeline.init:
org.gephi.desktop.timeline.up-to-date:
org.gephi.desktop.timeline.compile:
org.gephi.desktop.timeline.jar-prep:
org.gephi.desktop.timeline.jar:
org.gephi.desktop.timeline.netbeans-extra:
org.gephi.desktop.timeline.javahelp:
org.gephi.desktop.timeline.module-auto-deps:
org.gephi.desktop.timeline.release:
org.gephi.desktop.timeline.module-xml-regular:
org.gephi.desktop.timeline.module-xml-autoload:
org.gephi.desktop.timeline.module-xml-eager:
org.gephi.desktop.timeline.chmod-executables:
org.gephi.desktop.timeline.verify-class-linkage:
1 file(s) have been successfully validated.
org.gephi.desktop.timeline.netbeans:
Generating information for Auto Update...
org.netbeans.swing.dirchooser.taskdefs:
org.netbeans.swing.dirchooser.common-init:
org.netbeans.swing.dirchooser.projectized-common.basic-init:
org.netbeans.swing.dirchooser.basic-init:
org.netbeans.swing.dirchooser.files-init:
org.netbeans.swing.dirchooser.nbm-license-init:
org.netbeans.swing.dirchooser.build-init:
Scanning for modules in F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources\platform\platform
Scanning for modules in suite F:\Research\可视化\code\源码\gephi-0.8.1-beta.sources
org.netbeans.swing.dirchooser.init:
org.netbeans.swing.dirchooser.up-to-date:
org.netbeans.swing.dirchooser.compile:
org.netbeans.swing.dirchooser.jar-prep:
org.netbeans.swing.dirchooser.jar:
org.netbeans.swing.dirchooser.netbeans-extra:
org.netbeans.swing.dirchooser.javahelp:
org.netbeans.swing.dirchooser.module-auto-deps:
org.netbeans.swing.dirchooser.release:
org.netbeans.swing.dirchooser.module-xml-regular:
org.netbeans.swing.dirchooser.module-xml-autoload:
org.netbeans.swing.dirchooser.module-xml-eager:
org.netbeans.swing.dirchooser.chmod-executables:
org.netbeans.swing.dirchooser.verify-class-linkage:
0 file(s) have been successfully validated.
org.netbeans.swing.dirchooser.netbeans:
Generating information for Auto Update...
run:
run.run:
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。