Skip to content
Snippets Groups Projects
Commit e5d7b380 authored by Brandon Heller's avatar Brandon Heller
Browse files

topo: make new minimal Graph object a Graph, not a DiGraph

Fixes another Graph regression relative to NetworkX.

RipL broke because the NetworkX Graph object that was used previously
for topologies is an undirected graph:

>>> import networkx as nx
>>> g=nx.Graph()
>>> g.add_edge(0,1)
>>> g[1]
{0: {}}
>>> g[0]
{1: {}}

There is a separate DiGraph object in NetworkX for directed behavior.

The minimal replacement previously implemented DiGraph behavior.

>>> from mininet.topo import Graph
>>> g2=Graph()
>>> g2.add_edge(0,1)
>>> g2[0]
[1]
>>> g2[1]
[]

This commit restores undirected graph behavior.
parent 4e1630e1
No related branches found
No related tags found
Loading
......@@ -29,6 +29,7 @@ def add_edge( self, src, dest ):
self.add_node( src )
self.add_node( dest )
self.data[ src ].append( dest )
self.data[ dest ].append( src )
def nodes( self ):
"Return list of graph nodes"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment