You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately I don't have a way to get a node from the ID without looping through the nodes, which is probably the simplest way to implement this. Something like:
gf_node gf_nw_getNodeFromId(gf_network *nw, const char id) {
int k;
// add checks here for nw != NULL etc
You need to pass the network to this method or else it doesn't know which network you are referring to (you can have multiple networks loaded in theory - it's never been tested). Since you're passing the network, it's a method on a network object, hence the "gf_nw" prefix. That prefix convention is used throughout the C API. Hope this helps.
The text was updated successfully, but these errors were encountered:
I think the following method has the wrong docs associated with it:
_GraphfabExport gf_reaction* gf_nw_getRxnp(gf_network *n, size_t i)
Get the node at index i.
Ps what I need is a method like:
index gf_getNodeIndex (char *nodeId);
Unfortunately I don't have a way to get a node from the ID without looping through the nodes, which is probably the simplest way to implement this. Something like:
gf_node gf_nw_getNodeFromId(gf_network *nw, const char id) {
int k;
// add checks here for nw != NULL etc
for(k = 0; k< gf_nw_getNumNodes(nw); ++k) {
if( !strcmp(gf_node_getID(gf_nw_getNodep(nw)) , id) ) {
return gf_nw_getNodep(nw);
}
}
// not found: set some error condition here
}
You need to pass the network to this method or else it doesn't know which network you are referring to (you can have multiple networks loaded in theory - it's never been tested). Since you're passing the network, it's a method on a network object, hence the "gf_nw" prefix. That prefix convention is used throughout the C API. Hope this helps.
The text was updated successfully, but these errors were encountered: