Skip to content

Commit 3376eb5

Browse files
authored
Merge pull request #45 from petercorke/docs/reorganize-method-reference
docs: reorganize the method reference by task, docstring pass, new diagram
2 parents 9fe9d61 + 2136091 commit 3376eb5

28 files changed

Lines changed: 9901 additions & 2626 deletions

‎README.md‎

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div align="center">
44
<img src="https://raw.githubusercontent.com/petercorke/pgraph-python/main/docs/figs/pgraph_logo.png" width="450" alt="pgraph logo">
55
<br>
6-
<strong>Mathematical graphs for Python</strong>
6+
<strong>Graphs for Python</strong>
77
<br><br>
88

99
[![PyPI version](https://img.shields.io/pypi/v/pgraph-python?style=for-the-badge&color=blue)](https://pypi.org/project/pgraph-python/)
@@ -35,7 +35,15 @@
3535
[![powered by Matplotlib](https://img.shields.io/badge/powered_by-Matplotlib-11557c?logo=matplotlib&logoColor=white)](https://matplotlib.org)
3636
[![Powered by Spatial Maths](https://raw.githubusercontent.com/petercorke/spatialmath-python/master/.github/svg/sm_powered.min.svg)](https://github.com/petercorke/spatialmath-python)
3737

38-
This Python package allows the manipulation of directed and non-directed graphs. Also supports embedded graphs. It is suitable for graphs with thousands of nodes.
38+
This package provides classes for directed and undirected graphs: vertices
39+
connected by edges, with edge costs and path planning. Self-loops and
40+
parallel edges are permitted.
41+
42+
Vertices can optionally be *embedded*: given a coordinate in a space of any
43+
dimension. Edge costs are then computed from the vertex positions using a
44+
distance metric (Euclidean, Manhattan, SE(2), or your own), the vertex nearest
45+
a point can be found, `A*` uses the metric as its heuristic, and the graph can
46+
be plotted, or exported with its layout preserved.
3947

4048
![road network](https://github.com/petercorke/pgraph-python/raw/main/examples/roads.png)
4149

@@ -89,18 +97,18 @@ Graphs belong to the class `UGraph` or `DGraph` for undirected or directed graph
8997
- `g.incidence()` incidence matrix
9098

9199
### Properties and methods of a vertex
92-
Vertices belong to the class `UVertex` (for undirected graphs) or `DVertex` (for directed graphs), which are each subclasses of `Vertex`.
100+
Vertices belong to the class `UVertex` (for undirected graphs) or `DVertex` (for directed graphs), which are each subclasses of `BaseVertex`.
93101

94102
- `v.coord` the coordinate vector for embedded graph (optional)
95103
- `v.name` the name of the vertex (optional)
96-
- `v.neighbours()` is a list of the neighbouring vertices
104+
- `v.adjacent()` is a list of the adjacent vertices (`neighbours()` and `neighbors()` are the same)
97105
- `v1.samecomponent(v2)` predicate for vertices belonging to the same component
98106

99107
Vertices can be named and referenced by name.
100108

101109
### Properties and methods of an edge
102110
Edges are instances of the class `Edge`.
103-
Edges are not referenced by the graph object, each edge references a pair of vertices, and the vertices reference the edges. For a directed graph only the start vertex of an edge references the edge object, whereas for an undirected graph both vertices reference the edge object.
111+
Each edge references a pair of vertices, the graph lists all of its edges in `g.edges()`, and the vertices reference the edges. For a directed graph only the start vertex of an edge references the edge object, whereas for an undirected graph both vertices reference the edge object.
104112

105113
- `e.cost` cost of edge for planning methods
106114
- `e.next(v)` vertex on edge `e` that is not `v`
@@ -135,12 +143,6 @@ for f in f1.neighbours():
135143
# say hi to the neighbours
136144
```
137145

138-
## Under the hood
139-
140-
The key objects and their interactions are shown below.
141-
142-
![data structures](https://github.com/petercorke/pgraph-python/raw/main/docs/source/datastructures.png)
143-
144146
## MATLAB version
145147

146148
This is a re-engineered version of [PGraph.m](https://github.com/petercorke/spatialmath-matlab/blob/main/PGraph.m) which ships as part of the [Spatial Math Toolbox for MATLAB](https://github.com/petercorke/spatialmath-matlab). This class is used to support bundle adjustment, pose-graph SLAM and various planners such as PRM, RRT and Lattice.

0 commit comments

Comments
 (0)