I'm trying to use the Jung API (v2) to analyse a graph in Java.

I've applied an EdgePredicateFilter, which according to the docs returns an unassembled graph.

Apparently I'm now meant to assemble the graph, which should remove all the nodes without edges, using a call to an assemble() method, but I'm not sure where to find it. If I try and import edu.uci.ics.jung.filters.UnassembledGraph I get an error saying there's no such class.

How do I assemble the filtered subgraph?

有帮助吗?

解决方案

You're looking at the docs for v1, not v2: http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/algorithms/filters/EdgePredicateFilter.html In v2, EdgePredicateFilter.transform() returns a Graph, plain and simple.

If you want to remove the nodes without edges after your edge predicate filter has finished, you can do that as a separate VertexPredicateFilter pass.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top