fnss.topologies.topology.DirectedTopology.to_directed — FNSS 0.5.0 documentation

### Navigation

- index
- modules |
- modules |
- FNSS 0.5.0 documentation »

# fnss.topologies.topology.DirectedTopology.to_directed

`DirectedTopology.` `to_directed`()

  Return a directed representation of the topology.

  Returns : | topology : DirectedTopology A directed topology with the same name, same nodes, and with each edge (u,v,data) replaced by two directed edges (u,v,data) and (v,u,data).

  Notes

  This returns a ‘deepcopy’ of the edge, node, and graph attributes which attempts to completely copy all of the data and references.

  This is in contrast to the similar D=DirectedTopology(G) which returns a shallow copy of the data.

  See the Python copy module for more information on shallow and deep copies, http://docs.python.org/library/copy.html.

  Examples

      >>> topo = Topology()
      >>> topo.add_path([0,1])
      >>> topo2 = topo.to_directed()
      >>> topo2.edges()
      [(0, 1), (1, 0)]

  If already directed, return a (deep) copy

      >>> topo = DirectedTopology()
      >>> topo.add_path([0,1])
      >>> topo2 = topo.to_directed()
      >>> topo2.edges()
      [(0, 1)]

### Navigation

- index
- modules |
- modules |
- FNSS 0.5.0 documentation »