Class: QgsGraph

class qgis.analysis.QgsGraph

Bases: sip.wrapper

Constructor for QgsGraph.

QgsGraph(QgsGraph)

Mathematical graph representation

Methods

addEdge

Add an edge to the graph, going from the fromVertexIdx to toVertexIdx.

addVertex

Add a vertex to the graph

edge

Returns edge at given index

edgeCount

Returns number of graph edges

findVertex

Find vertex by associated point

vertex

Returns vertex at given index

vertexCount

Returns number of graph vertices

addEdge(self, fromVertexIdx: int, toVertexIdx: int, strategies: Iterable[Any]) → int

Add an edge to the graph, going from the fromVertexIdx to toVertexIdx.

Parameters
  • fromVertexIdx (int) –

  • toVertexIdx (int) –

  • strategies (Iterable[Any]) –

Return type

int

addVertex(self, pt: QgsPointXY) → int

Add a vertex to the graph

Parameters

pt (QgsPointXY) –

Return type

int

edge(self, idx: int) → QgsGraphEdge

Returns edge at given index

Parameters

idx (int) –

Return type

QgsGraphEdge

edgeCount(self) → int

Returns number of graph edges

Return type

int

findVertex(self, pt: QgsPointXY) → int

Find vertex by associated point

Return type

int

Returns

vertex index

Parameters

pt (QgsPointXY) –

vertex(self, idx: int) → QgsGraphVertex

Returns vertex at given index

Parameters

idx (int) –

Return type

QgsGraphVertex

vertexCount(self) → int

Returns number of graph vertices

Return type

int