# How to use accumulate field node for only connected vertices?

I'm trying to get sum of all relative positions of adjacent vertices, to use it for offsetting position of curent vertex. By connected vertices i mean sharing same edge. Sounds simple, but i can't really figure it out. Or just any way to check if some vertex is connected to curent vertex?

eg, i want to push all vertices from each other, like scaling every edge, but also changing their direction

Thank you

• Does this answer your question? How do I average values in a field per ID with Geometry Nodes? By definition, connected vertices form mesh islands, so you can use my setup there to get the average position, or the sum of positions… You can subtract from current position the average position to get the offset to the average position. If there's just 2 vertices in each island, you can subtract from the sum of positions the current position, giving you the other position. Aug 16, 2023 at 10:26
• @MarkusvonBroady sorry, by connected vertices i meant sharing same edge, not island Aug 16, 2023 at 10:32
• What are you trying to do exactly? Can you show the geometry you want to apply it on and what is the desired result? Aug 16, 2023 at 10:54
• @MarkusvonBroady edited my question Aug 16, 2023 at 11:29
• the way your question is currently phrased, and with the example provided, my first comment explains how to achieve that: "You can subtract from current position the average position to get the offset to the average position." - then you can use Vector Math: Scale to scale this offset, and pass it to Set Position: Offset. Aug 16, 2023 at 11:55

Or, using the same selection, you could also use the same node to find the first and the 2nd edge, sum up the positions of their verts, since you summed up 4 verts, divide it by 4 to get an average, and then subtract your own position from the equation - "your" (currently evaluated vertex) position was counted twice, so you would multiply it by 2 first, but since you already divided by 4, you get $${2\over4} = 0.5$$, so those are the two values in the Vector Math: Scale nodes below: