Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I output the filtered graph using the toolkit 0.9.1 #4

Open
ZhitongLei opened this issue Oct 16, 2016 · 0 comments
Open

How can I output the filtered graph using the toolkit 0.9.1 #4

ZhitongLei opened this issue Oct 16, 2016 · 0 comments

Comments

@ZhitongLei
Copy link

I'm trying to filter a graph by node degree using the toolkit 0.9.1.
The number of nodes is ok after filtered, but after exporting the graph, I can find the filtered nodes in the gexf file.
So how I can output the filtered graph?
Thanks.

    GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel();
    FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
    DegreeRangeFilter degreeFilter = new DegreeRangeFilter();
    degreeFilter.init(graphModel.getGraph());
    degreeFilter.setRange(new Range(1, Integer.MAX_VALUE));     //Remove isolated nodes
    Query query = filterController.createQuery(degreeFilter);
    GraphView view = filterController.filter(query);
    graphModel.setVisibleView(view);    //Set the filter result as the visible view

    // See if graph is well imported and filtered
    graph = graphModel.getDirectedGraphVisible();
    System.out.println("Nodes: " + graph.getNodeCount());   // number of nodes is ok after filtered
    System.out.println("Edges: " + graph.getEdgeCount())

    ExportController ec = Lookup.getDefault().lookup(ExportController.class)
    ec.exportFile(new File(outputFile)) ;  // filtered nodes is still in outputFile
@ZhitongLei ZhitongLei changed the title How I can output the filtered graph using the toolkit 0.9.1 How can I output the filtered graph using the toolkit 0.9.1 Oct 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant