class documentation
class Graph:
Representation of a simple graph using an adjacency map.
| Class | |
Lightweight edge structure for a graph. |
| Class | |
Lightweight vertex structure for a graph. |
| Method | __init__ |
Create an empty graph (undirected, by default). |
| Method | degree |
Return number of (outgoing) edges incident to vertex v in the graph. |
| Method | edge |
Return the number of edges in the graph. |
| Method | edges |
Return a set of all edges of the graph. |
| Method | get |
Return the edge from u to v, or None if not adjacent. |
| Method | incident |
Return all (outgoing) edges incident to vertex v in the graph. |
| Method | insert |
Insert and return a new Edge from u to v with auxiliary element x. |
| Method | insert |
Insert and return a new Vertex with element x. |
| Method | is |
Return True if this is a directed graph; False if undirected. |
| Method | vertex |
Return the number of vertices in the graph. |
| Method | vertices |
Return an iteration of all vertices of the graph. |
| Method | _validate |
Verify that v is a Vertex of this graph. |
| Instance Variable | _incoming |
Undocumented |
| Instance Variable | _outgoing |
Undocumented |
Create an empty graph (undirected, by default).
Graph is directed if optional paramter is set to True.
Return number of (outgoing) edges incident to vertex v in the graph.
If graph is directed, optional parameter used to count incoming edges.
Return all (outgoing) edges incident to vertex v in the graph.
If graph is directed, optional parameter used to request incoming edges.
Insert and return a new Edge from u to v with auxiliary element x.
Raise a ValueError if u and v are not vertices of the graph. Raise a ValueError if u and v are already adjacent.