Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FeatureReq]: Host function iteration over directed graph edges #1237

Open
DavidFletcherShef opened this issue Oct 15, 2024 · 0 comments
Open

Comments

@DavidFletcherShef
Copy link

Is your feature request related to a problem?

On the host it appears to be impossible to easily iterate through all the edges on a directed graph. It would be really useful if this facility was available.

Edges can be addressed using the format:

HostEnvironmentDirectedGraph::EdgeMap::Edge edge = edges[{i,j}];

But to do that you need to already know the source and target vertices. Iterating without this prior knowledge would be very useful.

Describe the solution you'd like

Agent functions offer graph.getEdgeSource(index) in which index is a single number that easily allows you to move through all edges, but from the agent function you can't then update the directed graph environment variable. Having similar iteration capability to work through all edges on the host would be really useful.

Describe alternatives you've considered

My current solution is to perform the calculation in an agent function when needed, but this means repeated output is being generated that could otherwise have been calculated once for each edge and stored.

Additional context

Iterating over the edges without knowing source and target is useful (for example) when a directed graph has been read in from a JSON file. Taking the graph to represent the spatial position of a series of locations it's useful for an initialisation function to pre-calculate and store within the graph the length of each edge. That's better than storing in the JSON and needing to keep the length in sync with any change of the vertices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant