-
-
Save sheymann/7585322 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import org.gephi.data.attributes.api.AttributeController | |
import org.gephi.graph.api.GraphController | |
import org.gephi.io.importer.api.EdgeDefault | |
import org.gephi.io.importer.api.ImportController | |
import org.gephi.io.processor.plugin.DefaultProcessor | |
import org.gephi.project.api.ProjectController | |
import org.gephi.statistics.plugin.Degree | |
import org.openide.util.Lookup | |
pc = Lookup.getDefault().lookup(ProjectController.class) | |
pc.newProject() | |
workspace = pc.getCurrentWorkspace() | |
importController = Lookup.getDefault().lookup(ImportController.class) | |
graphModel = Lookup.getDefault().lookup(GraphController.class).getModel() | |
attributeModel = Lookup.getDefault().lookup(AttributeController.class).getModel() | |
container = importController.importFile(new File(args[0])) | |
container.getLoader().setEdgeDefault(EdgeDefault.UNDIRECTED) | |
importController.process(container, new DefaultProcessor(), workspace) | |
graph = graphModel.getUndirectedGraph() | |
degree = new Degree() | |
degree.execute(graph.getGraphModel(), attributeModel) | |
println(degree.getAverageDegree()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment