I have a weighted graph with its nodes and edges.
Each node contains a LinkedList called edges that stores the edges of this node. Each edge has an weight and a node (node at the other end).
I already did this:
static void removeEdge(Node n1, Node n2)
{
n1.edges.Remove(n1.edges.First(a => a.node == n2));
n2.edges.Remove(n2.edges.First(a => a.node == n1));
}
I am trying to do an updateEdge method, that would take that same lambda expression and then do this:
(a => a.node == n2).weight = otherValue;
but I am getting an error. Isn't this allowed? Or am I doing something wrong? From what I've tested the lambda expression seems ok as far as removing the elements, though I'm new at this so I'm pretty lost tbh.