Giter Club home page Giter Club logo

Comments (5)

gboeing avatar gboeing commented on May 28, 2024 1

Closed by #1139

from osmnx.

gboeing avatar gboeing commented on May 28, 2024

This would be easy enough to implement but I want to make sure that it's theoretically sound first. I think it may be, though users may need a warning to ensure things proceed according to expectations. That is, should we allow the calculation of bearings on directed graphs?

If a user is interested in the bearings/orientation of flows, then maybe yes. If the user is interested in the bearings/orientation of physical infrastructure, then no. Perhaps a UserWarning as such is sufficient if a user passes a MultiDiGraph instead of a MultiGraph.

from osmnx.

dhimmel avatar dhimmel commented on May 28, 2024

Thanks @gboeing for your insights here.

should we allow the calculation of bearings on directed graphs? If a user is interested in the bearings/orientation of flows, then maybe yes. If the user is interested in the bearings/orientation of physical infrastructure, then no.

That is a helpful conceptual distinction, although there is certainly a relation between physical infrastructure and flow. Some examples are waterways, separated highways, one ways trails (common in mountain biking, skiing, etc). In all these cases, the physical infrastructure is designed to support directional flow.

Perhaps a UserWarning as such is sufficient if a user passes a MultiDiGraph instead of a MultiGraph.

Another option would be to keep the "graph must be undirected" error unless the user sets an additional argument like directed_bearings=True or omit_reverse=True.

The warning proposal also sounds good paired with documentation like: "Supplying a MultiDiGraph results in directional bearings. For bidirectional bearings, use MultiDiGraph.to_undirected()".

One final note, I initially come to this repository with the hopes of using the bearing calculation and polar histogram plotting without wanting to use a networkx graph. But many of the critical functions required a graph input. Putting the data into the graph was not too hard, but for me was solely for purposes of using the mature and powerful bearing/plotting functionality.

from osmnx.

gboeing avatar gboeing commented on May 28, 2024

Would you like to open a PR (targeting the v2 branch) to allow directed graphs, issue a UserWarning and update the docstring?

from osmnx.

dhimmel avatar dhimmel commented on May 28, 2024

Would you like to open a PR (targeting the v2 branch) to allow directed graphs

Okay will do!

Nice to see the type annotations for v2... will make contributing easier.

from osmnx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.