Cartesian Theater
Cartesian Theater

Reputation: 1970

Get Parent Vertex from a JGraphX Tree

Suppose I have a graph like this:

enter image description here

Suppose I also have a reference to the (Object) cell 573. Is there a way I can get a reference to its parent in the graph, the (Object) cell 792? Can't seem to find an answer in the api. I'm still pretty new to JGraphX.

Upvotes: 0

Views: 536

Answers (1)

Cartesian Theater
Cartesian Theater

Reputation: 1970

I found a way that seems to work pretty well: As I draw my graph from my Java data structure (in the form of a tree) I store in a hashmap key-value pairs for each element in the Java data structure and its corresponding object in the jgraph. That way I can easily get the corresponding jgraphx cell for any node in the tree of my data structure.

Upvotes: 0

Related Questions