Changeset 10852:e2f47fdb32b3 in orange


Ignore:
Timestamp:
04/26/12 09:53:01 (2 years ago)
Author:
mstajdohar
Branch:
default
Message:

Fixes #1183.

Location:
Orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeWidgets/Unsupervised/OWNxExplorer.py

    r10797 r10852  
    230230            ib = OWGUI.indentedBox(ribg, orientation=0) 
    231231            self.ctrlMarkDistance = OWGUI.spin(ib, self, "markDistance", 0, 100, 1, label="Distance ", 
    232                 callback=(lambda: self.set_mark_mode(2 if not self.hubs==3 else 3))) 
     232                callback=(lambda: self.set_mark_mode(2 if not self.hubs == 3 else 3))) 
    233233            #self.ctrlMarkFreeze = OWGUI.button(ib, self, "&Freeze", value="graph.freezeNeighbours", toggleButton = True) 
    234234            OWGUI.widgetLabel(ribg, "Mark nodes with ...") 
     
    236236            OWGUI.appendRadioButton(ribg, self, "hubs", "at most N connections", callback=self.set_mark_mode) 
    237237            self.ctrlMarkNConnections = OWGUI.spin(OWGUI.indentedBox(ribg), self, "markNConnections", 0, 1000000, 1, label="N ", 
    238                 callback=(lambda: self.set_mark_mode(4 if not self.hubs==5 else 5))) 
     238                callback=(lambda: self.set_mark_mode(4 if not self.hubs == 5 else 5))) 
    239239            OWGUI.appendRadioButton(ribg, self, "hubs", "more connections than any neighbour", callback=self.set_mark_mode) 
    240240            OWGUI.appendRadioButton(ribg, self, "hubs", "more connections than avg neighbour", callback=self.set_mark_mode) 
     
    492492                        return 
    493493 
    494                     cut = self.markNumber 
     494                    cut = min(self.markNumber, len(powers)) 
    495495                    cutPower = powers[cut - 1][1] 
    496496                    while cut < len(powers) and powers[cut][1] == cutPower: 
     
    816816            self.networkCanvas.set_graph(self.graph, curve, items=self.graph_base.items(), links=self.graph_base.links()) 
    817817 
    818             if self._items is not None and 'x' in self._items.domain and 'y' in self._items.domain: 
    819                 positions = dict((node, (self._items[node]['x'].value, self._items[node]['y'].value)) \ 
    820                              for node in self.graph if self._items[node]['x'].value != '?' \ 
    821                              and self._items[node]['y'].value != '?') 
     818            items = self.graph.items() 
     819            if items is not None and 'x' in items.domain and 'y' in items.domain: 
     820                positions = dict((node, (items[node]['x'].value, items[node]['y'].value)) \ 
     821                             for node in self.graph if items[node]['x'].value != '?' \ 
     822                             and items[node]['y'].value != '?') 
    822823 
    823824                self.networkCanvas.networkCurve.set_node_coordinates(positions) 
  • Orange/network/network.py

    r10469 r10852  
    190190        return [x for x in vars if str(x.name) != 'u' and str(x.name) != 'v'] 
    191191 
    192 class Graph(BaseGraph, nx.Graph): 
    193     """Bases: `NetworkX.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_,  
    194     :obj:`Orange.network.BaseGraph`  
    195      
    196     """ 
    197  
    198     def __init__(self, data=None, name='', **attr): 
    199         nx.Graph.__init__(self, data, name=name, **attr) 
    200         BaseGraph.__init__(self) 
    201  
    202192    def subgraph(self, nbunch): 
    203193        G = nx.Graph.subgraph(self, nbunch) 
     
    206196        G.set_items(items) 
    207197        return G 
     198 
     199class Graph(BaseGraph, nx.Graph): 
     200    """Bases: `NetworkX.Graph <http://networkx.lanl.gov/reference/classes.graph.html>`_,  
     201    :obj:`Orange.network.BaseGraph`  
     202     
     203    """ 
     204 
     205    def __init__(self, data=None, name='', **attr): 
     206        nx.Graph.__init__(self, data, name=name, **attr) 
     207        BaseGraph.__init__(self) 
    208208        # TODO: _links 
    209209 
Note: See TracChangeset for help on using the changeset viewer.