Search code examples
jung

Adding edge weights in JUNG based on edge length


I have coded a program which dynamically inserts nodes and edges, overlaying the graph onto an image. My aim is to be able to automatically add the edge weights based on pixel distances from one node to the next (edge length). Is this possible? If so could you guide me in the right direction. Thank you.


Solution

  • JUNG doesn't exactly have a native notion of edge weights (or any other edge- or vertex-related metadata). What it has instead is a convention for how to tell algorithms that need such metadata how to access it. For more information, see the "User Data" section here: https://sourceforge.net/apps/trac/jung/wiki/JUNGManual