Search code examples
javagraphvertexjungedges

Jung graph library: how to search vertices based on vertex property?


I am working with Jung framework to maintain and visualize my directed graph. My vertex and edge are custom classes. In the vertex class I maintain a set of vertex properties like, tag, state, etc.

I need to search the graph for vertex with specific property. For example, if a tag is given, i need to search the graph to find the vertex that hold that tag. I am not sure how to do it efficiently.

any help?


Solution

  • JUNG does not, itself, maintain indexes of your vertex tags, because it doesn't know anything about them. You will need to construct and maintain your own indexes (e.g., a Map from tag values to a set of vertices).

    Note that this is not a JUNG-specific question at all, really.