I wish to extract from an OSM file a road network, and export it as an array (adjacency matrix) where the nodes are the road intersections and the edges represent the road segments.
I don't want to just visualise it, but also export the resulting adjacency matrix as a file with a network data structure in at least one of the following formats: numpy file (.npy), pajek file (.net), gephi file (.gexf), csv file (.csv). Alternatively, a list of nodes and edges with geometric info would do.
A solution using either Python or QGIS would be highly appreciated.
Edit: I was hoping for something like this Matlab package, especially the 3rd item in the description. Unfortunately, I don't have Matlab installed on my machine.