Ignore link data referring to no node?

Thank you very much for such a quick response. I registered on the forum with my home e-mail so I hadn’t noticed your letter.



I have one more question. I have set ValidUnconnectedLinks to None in my model but it seems that it works only if link has both ends unconnected. But I have some invalid links in database which have one correct end and the other wrong (i.e. no such node in the graph). So the result looks like this (links point to 0,0?)



Is there an option to ignore link with only one invalid end?

ValidUnconnectedLinks.None is the default value, so you don’t need to set it.
In other words, the model normally ignores partly connected links.

You are using a GraphLinksModel with a node data key type of decimal. What value are you using as the “there-is-no-node-at-this-end” value for your link references to nodes? Are you using zero? It should be easy enough for you to filter out the link data that use that value as either the From or the To reference (or both).

Each node has decimal ID. I have no specific value for “there-is-no-node-at-this-end” but some links have “link from” or “link to” equal to the ID that is not in the list of nodes. It seems that when diagram is not able to find a node by key for a link end it places this end to top left corner of the diagram.

Sure it is not a problem to filter links so there be only IDs that exists in nodes list. I just asked if diagram already has a feature to ignore links where one of the ends (or both) is not found.

Oh, I see – yes, that’s yet another circumstance.

No, the model isn’t supposed to delete link data from the LinksSource collection, just because it cannot (yet) find a node data referent. In fact, it’s supposed to keep it around in case such a node data is added. Then it can magically resolve all of those previously unresolved references.

The GraphLinksModel.ClearUnresolvedReferences method forgets all of those references for which there is no node data. But it doesn’t remove any data (whether links or nodes) that has such a reference from the model.

You’ll need to do that programmatically. Use FindNodeByKey to see if the model knows about any node data using a given key value.

I guess it’s clear how your suggestion for a future feature could work for link data. But it isn’t so clear if nodes with dangling references should be removed from the model too.

By the way, not to confuse the matter any more, but the opposite feature already exists. In the special case that references to nodes are the same as the node data (NodeKeyIsNodeData is true), you can set NodeKeyReferenceAutoInserts to true to automatically add that value as new node data.