YourRatzon's blog

By YourRatzon, history, 9 years ago, In English

Hello, I am facing a task, and I am brainstorming for a good algorithm to achieve it, perhaps you can think with me.

I have a complete graph where every node represents an image, and every edge represents distance between images. Distance between images is a measure of how similar they are (the smaller the difference, the more similar are the images). Now, I want to create a pictorial collage with all the images that will group all the similar images next to each other. The more similar the images, the closer they are to one another.

The first step I've thought of is to create connected components by setting a threshold for distance, and removing all edges above this distance. I still haven't figured out a good way to place the images within each connected component.

Any ideas, or references to look at?

Thank you!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 years ago, # |
  Vote: I like it 0 Vote: I do not like it

If you need it for practice, then you can find useful library graphviz, especially neato. For example, let's take this graph:

graph G {
        n0 -- n1 [len=4.0];
        n1 -- n2 [len=8.0];
        n2 -- n0 [len=4.5];
        n0 -- n3 [len=10.0];
        n1 -- n3 [len=9.0];
        n2 -- n3 [len=8.1];
}

And this is output of neato (visualisation):

I think that algorithms in graphviz can help you with your task.

  • »
    »
    9 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Thank you, that's a very helpful reference, I'll check it out. Still wondering if there is a simple algorithm to make an image collage with pictures all right next to each other, as opposed to a graph.