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

Update Endpoint for Constrained Best Paths #67

Open
MarvinTorres opened this issue Sep 30, 2020 · 1 comment
Open

Update Endpoint for Constrained Best Paths #67

MarvinTorres opened this issue Sep 30, 2020 · 1 comment

Comments

@MarvinTorres
Copy link
Contributor

MarvinTorres commented Sep 30, 2020

pathfinder/main.py

Lines 73 to 91 in d8ba617

@rest('v2/', methods=['POST'])
def shortest_path(self):
"""Calculate the best path between the source and destination."""
data = request.get_json()
desired = data.get('desired_links')
undesired = data.get('undesired_links')
parameter = data.get('parameter')
paths = []
for path in self.graph.shortest_paths(data['source'],
data['destination'],
parameter):
paths.append({'hops': path})
paths = self._filter_paths(paths, desired, undesired)
return jsonify({'paths': paths})

Description

Pathfinder's current endpoint takes in a source, destination, desired links, undesired links, and parameters. However, the parameter variable does not hold constraints such as "Bandwidth must be at least 34 units". In addition, parameter becomes an argument for nx.shortest_simple_paths(...) which uses weights and not metadata. For more information on David's and my constraint design, refer to #62

Possible fixes

  • parameter holds constraints and shortest_path branches if such constraints are present. This maintains the management of one endpoint. However, this requires if statements that may need to be refactored in the future.
  • A new endpoint is created that processes the JSON object differently from the current one. This removes the branching requirement. However, this requires the management of two endpoints instead of one.

Motivation
During the senior project, David created a different endpoint that obtains the source, destination, flexible, inflexible, and minimum flexible hits from a JSON object and processes them accordingly. The request in general has to be added to the API, or users will be unable to find a shortest path that meets their requirements.

System Details

  • OS: Ubuntu 18.04
@MarvinTorres
Copy link
Contributor Author

@hdiogenes Is adding a new endpoint preferred over updating the current one?

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