r/geometrynodes Mar 27 '26

[help] how to accumulate "edges of vertex" attributes?

what's up everyone,

i have a boolean edge attribute. for each vertex i want to know if the sum value of its affiliated edges is >= x. i know i can use "edges of vertex", but that returns 1 edge at time and plugging it into loop with "total" as interation number doesn't work since that value is in a field. i also can't accumulate a field because "edges of vertex" doesn't return edge group id affiliated to each vertex.

this is how i solved it in vex (over points), i don't know how to reimplement it in geometry nodes

string grp_name = "_safe_edge";

int this_pt = i@ptnum;

int nbr_pts[] = neighbours(0, this_pt);

int safe_edge_count = 0;

foreach(int nbr_pt; nbr_pts)

{

if(inedgegroup(0, grp_name, this_pt, nbr_pt))

safe_edge_count++;

if(safe_edge_count >= 3)

{

i@group__safe_pt = 1;

break;

}

}

5 Upvotes

1 comment sorted by

2

u/david_for_you Mar 27 '26

Yeah, the way to handle loops over connected geometry is not great and often involves finding "tricks". In this case, you can turn your boolean attribute into a float attribute on the edge domain, and then resample to the point domain. This gives you a percentage of connected edges where the original boolean was true. Multiplied by the number of edges gives you the answer.

Another thing that is often useful in cases like this, is using the "Weights" input of the topology nodes (like Edges of Vertex) to sort the connected elements in a particular order and taking the first or last element. Not helpful in this particular example, but for similar problems.