[Qgis-developer] Adjacency Matrix - Connectivity Matrix
gene
martin.laloux at gmail.com
Sat May 25 00:57:34 PDT 2013
Yes, use the networkx Python module with one layer (see How to transform a
shapefile in Python or a ESRI feature class in a topological network in
http://www.portailsig.org/content/python-comment-transformer-un-fichier-shapefile-ou-une-feature-class-d-esri-en-un-reseau-top
<http://www.portailsig.org/content/python-comment-transformer-un-fichier-shapefile-ou-une-feature-class-d-esri-en-un-reseau-top>
in French)
import networkx as nx
G = nx.read_shp('mylines.shp')
print(G.nodes())
[(1.0, 2.0), (3.0, 2.0), (0.0, 0.0), (3.0, 1.0), (4.0, 4.0), (2.0,
1.0), (2.0, 4.0), (1.0, 3.0), (2.0, 3.0), (1.0, 4.0), (4.0, 3.0), (4.0,
2.0), (3.0, 4.0), (1.0, 1.0)]
print(G.edges())
[((1.0, 2.0), (1.0, 1.0)), ((3.0, 2.0) ....
and the adjacency matrix with
http://networkx.github.io/documentation/latest/reference/generated/networkx.linalg.graphmatrix.adjacency_matrix.html
<http://networkx.github.io/documentation/latest/reference/generated/networkx.linalg.graphmatrix.adjacency_matrix.html>
¶
The Network analysis library
(http://www.qgis.org/pyqgis-cookbook/network-analysis.html) use this Python
module and see the direct application of graph theory in "QGIS and Graph
analysis" in http://groupefmr.hypotheses.org/1254
<http://groupefmr.hypotheses.org/1254> (in French), with an experimental
QGIS plugin
You can also use the Shapely modules for planar graphs
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Adjacency-Matrix-Connectivity-Matrix-tp5055618p5055684.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
More information about the Qgis-developer
mailing list