【问题标题】:How to create an Adjacency and a Degree matrix from OSMNX retrieved data?如何从 OSMNX 检索到的数据创建邻接矩阵和度矩阵?
【发布时间】:2021-10-21 05:42:15
【问题描述】:

我正在尝试根据从 OSMNX 包中检索到的数据创建 Adjacency matrixDegree matrix
例如,我想用以下道路网络的数据创建这些矩阵:

import osmnx as ox
G = ox.graph_from_bbox(37.79, 37.78, -122.41, -122.43, network_type='drive')
# Get nodes and edges
nodes, edges = ox.graph_to_gdfs(G)

谁能给我一个提示,告诉我如何使用这些输出来做到这一点?

【问题讨论】:

    标签: python openstreetmap osmnx


    【解决方案1】:

    为了创建邻接矩阵,您可以使用 networkx (Docs):

    nx.adjacency_matrix(G)
    

    【讨论】:

    • 谢谢@McToel。
    猜你喜欢
    • 2023-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多