fnss.topologies.topology.Topology.to_undirected

Topology.to_undirected()[source]

Return an undirected copy of the topology.

Returns :

topology : Topology

A undirected copy of the topology.

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 G=Topology(D) 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()   # or MultiGraph, etc
>>> topo.add_path([0,1])
>>> topo2 = topo.to_directed()
>>> topo2.edges()
[(0, 1), (1, 0)]
>>> topo3 = topo2.to_undirected()
>>> topo3.edges()
[(0, 1)]