Graphs: sift in something like a for-loop? or what? or how?

hi

still working on some graph visualizing issues i stumbled over a problem (something i considered to be really easy solveable - and now i already spent two days on it… - what a shame…)

given is a graph connection file as csv which basically looks like this:

A - B
A - C
A - D
E - B
E - D
… and so on

of course its not chars but ints and the linecount is over 44000

the graph already works fine. now i want to find all elements connected to one chosen element (iE B).

what i did is separating the list in two spreads (1st and 2nd column). than i did “a sift” for B and “select” the corresponding values from the other column. - this procedure needs to be iterated until all connected elements are found…

how do i do such an interation in vvvv? in pd i was used to write so called “expressions” for stuff like that but i am shure there is a smarter way in vvvv.

any help appreciated :)

best
wolfgang

ah well…

found traverse…

still have to find out how it works - but it should do the job…

still interested in this iteration stuff anyway…

best
wolfgang

well - traverse is a very nice module - but unfortunately not the thing i need… it is much to “overdressed” for my simple task…

maybe someone could have another look on my prob (posting nr.1)

best

whats wrong with the sift-select combination? sounds like a good way to go.

if there’s specific problem with using that, you could post an example to illustrate

w

well… if i only knew whats wrong with it… it works out fine in my “small scale test” but when i raise the line count to above 300 (which is still very “small scale”) it performs somehow randomly - some “link clusters” work fine - some don`t.

until now i already tried tons of workarounds to the sift/select method but all end up with the same error…

i also checked the csv file for problems (its coming from a quiet chaotic database and has a lot of redundancy in it - but the redundancy cannot be the problem)

i cannot really post my patch as its already so chaotic that maybe only me will be able to get it to show anything… i made up a little rough example (so don`t blame me for bad patching in this)… also the “nearest neighbours” approach is not the sift/select version described above but one of the 100000 desperate workarounds i did (btw: is there a better way to find out if a value is pair or unpair than in my example) - still this workaround is producing the same wrong results as the sift/select method…

best
wolfgang

damn_graphs.rar (64.7 kB)

finally… after days of confusion and stupidity the thing is working and i ended up in directly linking back to my first posting ;)…

in the example attached there is a subpatch called “nearest neighbours” and the iteration is done manually by copying the same sift/select block four times… - of course this will lead to problems with much more lines/elements… so this manual copying somehow needs to be replaced by a loop or something i don`t know…

best
wolfgang

damn_graphs02.rar (17.1 kB)

this procedure needs to be iterated until all connected elements are found…

i don’t know if i understand fully. you would e.g. start at A, sift for all X in any A-X connection, collect them, then sift for all Y in any X-Y connection… rinse & repeat until no more connections are found?

for that sort of thing you would either need a feedback loop (for storing & re-sifting the found connections) - which also implies the sifting will take more than 1 frame to resolve - or a plugin. it sounds like it would be a trivial thing to write (for people knowing their way around plugins).

before i start patching an example:
is you’re data consitent the way the example is?
as far as i could tell elements of column a can have multiple connections to column b but not vice versa. which would automatically limit the iterations you’d have to do.

if not it really looks like a plugin task

well… the second set i have sent only has 300 lines (in this one there are really just multiple connection from column a - which is just by accident)… the first set has 13000 lines (with multiple connections from both columns :( )…

i could actually try to write the plugin myself (already did write a very simple plugin just for learning) - but as i am not really so much into programming it would really take me quiet a long time with days of debuging and finding errors ;) )

i can`t really estimate if such a plugin might be a valuable contribution to v4… if yes it would be cool if somebody else would write it (someone who can do it fast (as it seems not to be to hard), and in good code…) - i could imagine that it would be a nice add-on to the traverse node (which is really handy for other tasks in my patch)…

if nobody else might need that thing - well - than i`ll have to try to write it myself…

best
wolfgang

ok, here a solution with a plugin.

plugin is still beta, so any recomendations and bugfixes appreciated

grrrraphs.zip (16.5 kB)

and here the plugin solicito

FindRelated_beta.zip (5.0 kB)

whoa, nice! will test this asap (tomorrow)!

wow… that went fast…

thousand thanks - i will test this in the afternoon…

best wolfgang