"""Constructs a new Graph object.
Args:
- directed: are we modeling a directed graph? See ::meth
- add_edge.
+ directed: are we modeling a directed graph? See :meth:`add_edge`.
"""
self.directed = directed
.. note::
- If either or both of src and dest are not already added to the
- graph, they are implicitly added by adding this edge.
+ If either or both of src and dest are not already added to
+ the graph, they are implicitly added by adding this edge.
Args:
src: the source vertex id
Returns:
An ordered sequence of vertex ids visited by the traversal.
- A ------ B
- | |
- | |
- C ------ D ------ E ------ F -O
- |
- |
- G
+ .. graphviz::
+
+ graph g {
+ node [shape=record];
+ A -- B -- D;
+ A -- C -- D -- E -- F;
+ F -- F;
+ E -- G;
+ }
>>> g = Graph()
>>> g.add_edge('A', 'B')
Returns:
An ordered sequence of vertex ids visited by the traversal.
- A ------ B
- | |
- | |
- C ------ D ------ E ------ F -O
- |
- |
- G
+ .. graphviz::
+
+ graph g {
+ node [shape=record];
+ A -- B -- D;
+ A -- C -- D -- E -- F;
+ F -- F;
+ E -- G;
+ }
>>> g = Graph()
>>> g.add_edge('A', 'B')