Seite 1 von 1

A4P2 edges4connected

Verfasst: 17. Jan 2013 19:02
von andre_w
Hallo,

ich bin mir nicht sicher, ob ich richtig verstanden habe, was die Funktion edges4connected zurückgeben soll. Angenommen, wir haben nun einen Aufruf edges4connected(3,2). Dieser würde einen solchen Graph ergeben:

\(\begin{array}{ccc}
1 & - & 4 \\
| & & | \\
2 & - & 5 \\
| & & | \\
3 & - & 6 \end{array}\)


Wäre die folgende Ausgabe nun richtig?

\(\left( \begin{array}{ccc}
1 & 2 \\
1 & 4 \\
2 & 3 \\
2 & 5 \\
3 & 6 \\
4 & 5 \\
5 & 6 \end{array} \right)\)


Beste Grüße,
Andre

Re: A4P2 edges4connected

Verfasst: 17. Jan 2013 19:06
von andre_w
Dürfen wir eine Schleife für diese Methode verwenden?

Re: A4P2 edges4connected

Verfasst: 18. Jan 2013 11:28
von franzel
Hi,

your solution is correct. it contains all the edges of a (3,2) image in a list.

You should implement this without any loops. Loops are only allowed when implementing iterative procedures like iterating over labels in alphaexpansion(...).

Regards,
Thorsten

Re: A4P2 edges4connected

Verfasst: 21. Jan 2013 21:56
von robert.n
I have two questions regarding edges4connected.

1. Is the intra-node order allowed to vary, e.g. is this also a valid solution (first add all down edges etc.)?
1 2
2 3
4 5
5 6
1 4
2 5
3 6

2. Are edges allowed to be specified in both directions?

Re: A4P2 edges4connected

Verfasst: 22. Jan 2013 12:01
von franzel
1. The order is not of relevance, since you build a sparse matrix (sparse()) out of this list. This is basically an intermediate step to building the "pairwise" variable.

2. You basically create an adjacency matrix, where only the upper triangle is used. The GCO library assumes undirected edges as stated in the library documentation.