From e5d7b3801df2769ef291cd17917b099f990edaa6 Mon Sep 17 00:00:00 2001 From: Brandon Heller Date: Thu, 20 Jun 2013 18:47:27 -0700 Subject: [PATCH] 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. --- mininet/topo.py | 1 + 1 file changed, 1 insertion(+) diff --git a/mininet/topo.py b/mininet/topo.py index d09004c..fa20e19 100644 --- a/mininet/topo.py +++ b/mininet/topo.py @@ -29,6 +29,7 @@ class Graph( object ): 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"