1 | initial version |

Once you create the graph:

```
sage: g = graphs.CompleteGraph(5)
sage: g
Complete graph: Graph on 5 vertices
```

The documentation of `to_directed`

says:

```
sage: g.to_directed?
Signature: g.to_directed(data_structure=None, sparse=None)
Docstring:
Return a directed version of the graph.
A single edge becomes two edges, one in each direction.
INPUT:
* "data_structure" -- one of ""sparse"", ""static_sparse"", or
""dense"". See the documentation of "Graph" or "DiGraph".
* "sparse" -- boolean (default: "None"); "sparse=True" is an
alias for "data_structure="sparse"", and "sparse=False" is an
alias for "data_structure="dense"".
EXAMPLES:
sage: graphs.PetersenGraph().to_directed()
Petersen graph: Digraph on 10 vertices
```

So, this is what happens if you provide wrong input:

```
sage: g.to_directed('wrong input')
Traceback (most recent call last)
...
ValueError: data_structure must be equal to 'sparse', 'static_sparse' or 'dense'
```

Following what the documentation says:

```
sage: g.to_directed('dense')
Complete graph: Digraph on 5 vertices
```

You may also create a directed graph directly using `DiGraph`

(various different type of inputs), see the documentation.

2 | No.2 Revision |

Once you create the graph:

```
sage: g = graphs.CompleteGraph(5)
sage: g
Complete graph: Graph on 5 vertices
```

~~The documentation of ~~`to_directed`

says:

```
sage: g.to_directed?
Signature: g.to_directed(data_structure=None, sparse=None)
Docstring:
Return a directed version of the graph.
A single edge becomes two edges, one in each direction.
INPUT:
* "data_structure" -- one of ""sparse"", ""static_sparse"", or
""dense"". See the documentation of "Graph" or "DiGraph".
* "sparse" -- boolean (default: "None"); "sparse=True" is an
alias for "data_structure="sparse"", and "sparse=False" is an
alias for "data_structure="dense"".
EXAMPLES:
sage: graphs.PetersenGraph().to_directed()
Petersen graph: Digraph on 10 vertices
```

So, this This is what happens if you provide wrong input:

```
sage: g.to_directed('wrong input')
Traceback (most recent call last)
...
ValueError: data_structure must be equal to 'sparse', 'static_sparse' or 'dense'
```

Following what the documentation ~~says:~~of the method to_directed for undirected graphs says, you may instead write:

```
sage: g.to_directed('dense')
Complete graph: Digraph on 5 vertices
```

You may also create a directed graph directly using `DiGraph`

(various different type of inputs), see the documentation.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.