Subgroup: Graph

Class: QgsGraphAnalyzer

class qgis.analysis.QgsGraphAnalyzer

Bases: sip.wrapper

This class performs graph analysis, e.g. calculates shortest path between two points using different strategies with Dijkstra algorithm

Methods

dijkstra Solve shortest path problem using Dijkstra algorithm
shortestTree Returns shortest path tree with root-node in startVertexIdx

Signals

Attributes

dijkstra(source: QgsGraph, startVertexIdx: int, criterionNum: int, resultTree: Iterable[int] = [], resultCost: Iterable[float] = []) → List

Solve shortest path problem using Dijkstra algorithm

Parameters:
  • source – source graph
  • startVertexIdx – index of the start vertex
  • criterionNum – index of the optimization strategy
  • resultTree – array that represents shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reachable, otherwise resultTree[ vertexIndex ] == -1. Note that the startVertexIdx will also have a value of -1 and may need special handling by callers.
  • resultCost – array of the paths costs
shortestTree(source: QgsGraph, startVertexIdx: int, criterionNum: int) → QgsGraph

Returns shortest path tree with root-node in startVertexIdx

Parameters:
  • source – source graph
  • startVertexIdx – index of the start vertex
  • criterionNum – index of the optimization strategy