Open andrewtheis opened 2 weeks ago
Hi, thanks for the interest!
I think currently there's no way to get nodeIdLookup
from View API, because the force
parameter is designed to work without the knowledge of the graph structure. This is a nice gotcha but probably need some rework on View APIs. I'll get back to you later.
First, let me say this is a fantastic library! However, there's a shortcoming when it comes to the
ForceDescriptor
types.For example, it's not possible to lookup the original source / target IDs in the
Kinetics2D.LinkStiffness.varied
closure, as they're type-erased toEdgeID<Int>
internally (for performance reasons I assume).A workaround could be to carefully track the expected
Int
id value in some way as they're added toSeries
, but obviously this is a very fragile solution.To solve this, ideally
nodeIndexLookup
would be exposed in some way, possibly by updating the theforce:
closure onForceDirectedGraph
init
to include the lookup hash table:Alternatively,
NodeMark
/LinkMark
could include values for settingstiffness
, etc and then the lookup would continue to happen internally:If I can find time, I might take a crack at one of these solutions, but I'm sure this is something you've already thought of implementing!