Class: QgsGraph

class qgis.analysis.QgsGraph

Bases: sip.wrapper

Constructor for QgsGraph.

QgsGraph(QgsGraph)

Mathematical graph representation

New in version 3.0: 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

Signals

Attributes

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

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

addVertex(self, pt: QgsPointXY) → int

Add a vertex to the graph

edge(self, idx: int) → QgsGraphEdge

Returns edge at given index

edgeCount(self) → int

Returns number of graph edges

findVertex(self, pt: QgsPointXY) → int

Find vertex by associated point

Returns:vertex index
vertex(self, idx: int) → QgsGraphVertex

Returns vertex at given index

vertexCount(self) → int

Returns number of graph vertices