|
1 | 1 | Graph analysis |
2 | 2 | =============== |
3 | 3 |
|
4 | | -Querying structure -- counts, adjacent vertices, connectivity, distance -- for directed and |
5 | | -undirected graphs. |
6 | | -See :doc:`planning` for |
7 | | -finding paths between vertices, and :doc:`representations` for matrix/dot forms of the |
8 | | -whole graph. |
| 4 | +Querying structure -- counts, adjacent vertices, incident edges, degree, |
| 5 | +connectivity, distance -- for directed and undirected graphs. |
| 6 | +See :doc:`planning` for finding paths between vertices, and |
| 7 | +:doc:`representations` for the matrix and dot forms of the whole graph. |
| 8 | + |
| 9 | +A vertex is queried in two complementary ways: by the vertices it is |
| 10 | +*adjacent* to, and by the *edges* incident on it. For the adjacent vertices |
| 11 | +:meth:`~pgraph.PGraph.Vertex.adjacent` is the canonical name; for a directed |
| 12 | +graph :meth:`~pgraph.PGraph.Vertex.successors` is the same list under its |
| 13 | +directed name, and :meth:`~pgraph.PGraph.Vertex.predecessors` is the vertices |
| 14 | +with an edge *to* the vertex. The edges are |
| 15 | +:meth:`~pgraph.PGraph.Vertex.out_edges` and |
| 16 | +:meth:`~pgraph.PGraph.Vertex.in_edges`, and |
| 17 | +:meth:`~pgraph.PGraph.Vertex.incidences` pairs each adjacent vertex with the |
| 18 | +edge that leads to it. :meth:`~pgraph.PGraph.Vertex.edgeto` is the edge to |
| 19 | +one adjacent vertex, the cheapest if there are parallel edges, and |
| 20 | +:meth:`~pgraph.PGraph.Vertex.edges_to` lists all of them. |
9 | 21 |
|
10 | 22 | Graph |
11 | 23 | ----- |
12 | 24 |
|
| 25 | +The size and kind of the graph |
| 26 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 27 | + |
13 | 28 | .. autosummary:: |
14 | 29 | :nosignatures: |
15 | 30 |
|
16 | 31 | ~pgraph.PGraph.Graph.n |
17 | 32 | ~pgraph.PGraph.Graph.ne |
18 | 33 | ~pgraph.PGraph.Graph.nc |
| 34 | + ~pgraph.PGraph.Graph.directed |
19 | 35 | ~pgraph.PGraph.Graph.edges |
20 | | - ~pgraph.PGraph.Graph.average_degree |
| 36 | + |
| 37 | +Structure and connectivity |
| 38 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 39 | + |
| 40 | +.. autosummary:: |
| 41 | + :nosignatures: |
| 42 | + |
21 | 43 | ~pgraph.PGraph.Graph.iscyclic |
22 | | - ~pgraph.PGraph.Graph.connectivity |
23 | 44 | ~pgraph.PGraph.Graph.component |
24 | 45 | ~pgraph.PGraph.Graph.samecomponent |
| 46 | + ~pgraph.PGraph.Graph.connectivity |
| 47 | + ~pgraph.PGraph.Graph.average_degree |
| 48 | + |
| 49 | +Geometry and consistency |
| 50 | +^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 51 | + |
| 52 | +.. autosummary:: |
| 53 | + :nosignatures: |
| 54 | + |
25 | 55 | ~pgraph.PGraph.Graph.closest |
| 56 | + ~pgraph.PGraph.Graph.validate |
| 57 | + |
| 58 | +The matrices of a graph (:meth:`~pgraph.PGraph.Graph.adjacency`, |
| 59 | +:meth:`~pgraph.PGraph.Graph.degree`, :meth:`~pgraph.PGraph.Graph.incidence`, |
| 60 | +:meth:`~pgraph.PGraph.Graph.laplacian`, :meth:`~pgraph.PGraph.Graph.distance`) |
| 61 | +are in :doc:`representations`. |
26 | 62 |
|
27 | 63 | Vertex |
28 | 64 | ------ |
29 | 65 |
|
| 66 | +Identity and position |
| 67 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 68 | + |
| 69 | +.. autosummary:: |
| 70 | + :nosignatures: |
| 71 | + |
| 72 | + ~pgraph.PGraph.Vertex.name |
| 73 | + ~pgraph.PGraph.Vertex.label |
| 74 | + ~pgraph.PGraph.Vertex.x |
| 75 | + ~pgraph.PGraph.Vertex.y |
| 76 | + ~pgraph.PGraph.Vertex.z |
| 77 | + |
| 78 | +Adjacent vertices |
| 79 | +^^^^^^^^^^^^^^^^^^ |
| 80 | + |
30 | 81 | .. autosummary:: |
31 | 82 | :nosignatures: |
32 | 83 |
|
33 | | - ~pgraph.PGraph.Vertex.edges |
34 | 84 | ~pgraph.PGraph.Vertex.adjacent |
35 | 85 | ~pgraph.PGraph.Vertex.isadjacent |
| 86 | + ~pgraph.PGraph.Vertex.successors |
| 87 | + ~pgraph.PGraph.Vertex.predecessors |
| 88 | + |
| 89 | +.. note:: ``neighbours()`` and ``neighbors()`` are the same method as |
| 90 | + :meth:`~pgraph.PGraph.Vertex.adjacent`, and ``isneighbour()`` and |
| 91 | + ``isneighbor()`` the same as :meth:`~pgraph.PGraph.Vertex.isadjacent`. |
| 92 | + They are spelling variants, not deprecated. |
| 93 | + |
| 94 | +Incident edges |
| 95 | +^^^^^^^^^^^^^^^ |
| 96 | + |
| 97 | +.. autosummary:: |
| 98 | + :nosignatures: |
| 99 | + |
| 100 | + ~pgraph.PGraph.Vertex.edges |
| 101 | + ~pgraph.PGraph.Vertex.out_edges |
| 102 | + ~pgraph.PGraph.Vertex.in_edges |
36 | 103 | ~pgraph.PGraph.Vertex.incidences |
| 104 | + ~pgraph.PGraph.Vertex.edgeto |
| 105 | + ~pgraph.PGraph.Vertex.edges_to |
| 106 | + |
| 107 | +Degree |
| 108 | +^^^^^^^ |
| 109 | + |
| 110 | +.. autosummary:: |
| 111 | + :nosignatures: |
| 112 | + |
37 | 113 | ~pgraph.PGraph.Vertex.degree |
38 | | - ~pgraph.PGraph.Vertex.heuristic_distance |
| 114 | + ~pgraph.PGraph.Vertex.in_degree |
| 115 | + ~pgraph.PGraph.Vertex.out_degree |
| 116 | + |
| 117 | +Distance |
| 118 | +^^^^^^^^^ |
| 119 | + |
| 120 | +.. autosummary:: |
| 121 | + :nosignatures: |
| 122 | + |
39 | 123 | ~pgraph.PGraph.Vertex.distance |
40 | | - ~pgraph.PGraph.Vertex.x |
41 | | - ~pgraph.PGraph.Vertex.y |
42 | | - ~pgraph.PGraph.Vertex.z |
| 124 | + ~pgraph.PGraph.Vertex.heuristic_distance |
| 125 | + ~pgraph.PGraph.Vertex.closest |
| 126 | + |
| 127 | +Edge |
| 128 | +---- |
| 129 | + |
| 130 | +An :class:`~pgraph.PGraph.Edge` is described in full on :doc:`edges_vertices`. The |
| 131 | +attributes and methods used to query one are |
| 132 | + |
| 133 | +.. autosummary:: |
| 134 | + :nosignatures: |
| 135 | + |
| 136 | + ~pgraph.PGraph.Edge.v1 |
| 137 | + ~pgraph.PGraph.Edge.v2 |
| 138 | + ~pgraph.PGraph.Edge.endpoints |
| 139 | + ~pgraph.PGraph.Edge.next |
| 140 | + |
| 141 | +and every edge also has ``cost`` and ``data`` attributes. |
43 | 142 |
|
44 | 143 | Details |
45 | 144 | ------- |
46 | 145 |
|
47 | 146 | .. autoproperty:: pgraph.PGraph.Graph.n |
48 | 147 | .. autoproperty:: pgraph.PGraph.Graph.ne |
49 | 148 | .. autoproperty:: pgraph.PGraph.Graph.nc |
| 149 | +.. autoproperty:: pgraph.PGraph.Graph.directed |
50 | 150 | .. automethod:: pgraph.PGraph.Graph.edges |
51 | | -.. automethod:: pgraph.PGraph.Graph.average_degree |
52 | 151 | .. automethod:: pgraph.PGraph.Graph.iscyclic |
53 | | -.. automethod:: pgraph.PGraph.Graph.connectivity |
54 | 152 | .. automethod:: pgraph.PGraph.Graph.component |
55 | 153 | .. automethod:: pgraph.PGraph.Graph.samecomponent |
| 154 | +.. automethod:: pgraph.PGraph.Graph.connectivity |
| 155 | +.. automethod:: pgraph.PGraph.Graph.average_degree |
56 | 156 | .. automethod:: pgraph.PGraph.Graph.closest |
| 157 | +.. automethod:: pgraph.PGraph.Graph.validate |
57 | 158 |
|
58 | | -.. automethod:: pgraph.PGraph.Vertex.edges |
| 159 | +.. autoproperty:: pgraph.PGraph.Vertex.name |
| 160 | +.. autoproperty:: pgraph.PGraph.Vertex.label |
| 161 | +.. autoproperty:: pgraph.PGraph.Vertex.x |
| 162 | +.. autoproperty:: pgraph.PGraph.Vertex.y |
| 163 | +.. autoproperty:: pgraph.PGraph.Vertex.z |
59 | 164 | .. automethod:: pgraph.PGraph.Vertex.adjacent |
60 | 165 | .. automethod:: pgraph.PGraph.Vertex.isadjacent |
| 166 | +.. automethod:: pgraph.PGraph.Vertex.successors |
| 167 | +.. automethod:: pgraph.PGraph.Vertex.predecessors |
| 168 | +.. automethod:: pgraph.PGraph.Vertex.edges |
| 169 | +.. automethod:: pgraph.PGraph.Vertex.out_edges |
| 170 | +.. automethod:: pgraph.PGraph.Vertex.in_edges |
61 | 171 | .. automethod:: pgraph.PGraph.Vertex.incidences |
| 172 | +.. automethod:: pgraph.PGraph.Vertex.edgeto |
| 173 | +.. automethod:: pgraph.PGraph.Vertex.edges_to |
62 | 174 | .. autoproperty:: pgraph.PGraph.Vertex.degree |
63 | | -.. automethod:: pgraph.PGraph.Vertex.heuristic_distance |
| 175 | +.. autoproperty:: pgraph.PGraph.Vertex.in_degree |
| 176 | +.. autoproperty:: pgraph.PGraph.Vertex.out_degree |
64 | 177 | .. automethod:: pgraph.PGraph.Vertex.distance |
65 | | -.. autoproperty:: pgraph.PGraph.Vertex.x |
66 | | -.. autoproperty:: pgraph.PGraph.Vertex.y |
67 | | -.. autoproperty:: pgraph.PGraph.Vertex.z |
| 178 | +.. automethod:: pgraph.PGraph.Vertex.heuristic_distance |
| 179 | +.. automethod:: pgraph.PGraph.Vertex.closest |
0 commit comments