Class: QgsGraph¶
- class qgis.analysis.QgsGraph¶
Bases:
sip.wrapper
Mathematical graph representation
New in version 3.0.
QgsGraph() Constructor for QgsGraph.
QgsGraph(
QgsGraph
)Methods
Add an edge to the graph, going from the
fromVertexIdx
totoVertexIdx
.Add a vertex to the graph
Returns edge at given index
Returns number of graph edges
Find vertex by associated point
Returns vertex at given index
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
totoVertexIdx
.- 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:
- 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:
- vertexCount(self) int ¶
Returns number of graph vertices
- Return type:
int