Instead of just checking for SourceLinks = 0, you need to check through each of the SourceLinks.FromNode to see if it is in the Selection.
This code will find all the “from” edge nodes… (and select them so you can see what it found)
private void buttonedges_Click(object sender, EventArgs e) {
GoCollection edges = new GoCollection();
foreach (GoObject o in CurrentView.Selection) {
IGoNode n = o as IGoNode;
if (n != null) {
foreach (IGoLink sl in n.SourceLinks) {
GoNode from = sl.FromNode as GoNode;
if (!CurrentView.Selection.Contains(from)) {
edges.Add(from);
}
}
}
}
CurrentView.Selection.Clear();
CurrentView.Selection.AddRange(edges);
}