コード例 #1
0
    def setUp(self):
        super(TestGraphCanvasMultiGraph, self).setUp()

        # Add in some extra edges
        G = nx.MultiGraph(self.input_G)
        G.add_edge('a', 'c')

        G.add_edge('out', 12)
        G.add_edge('out', 12)
        G.add_edge('out', 12)
        self.input_G = G.copy()

        # Viewer under test
        self.a = nxv.GraphCanvas(G)
コード例 #2
0
    def setUp(self):
        # Create graph same as basic GraphCanvas
        super(TestGraphCanvasTkPassthrough, self).setUp()

        # Add some attributes to the dictionary to pass through to tk
        G = self.input_G.copy()
        G.nodes['a']['fill'] = 'white'
        G.nodes['a']['dash'] = (2, 2)
        G.nodes[2]['label_fill'] = 'blue'
        G.nodes[2]['label_text'] = 'LOOOOOONG'
        G.get_edge_data('a', 'c').update({'dash': (2, 2)})
        G.get_edge_data('out', 'c').update({'fill': 'red', 'width': 3})

        self.input_G = G.copy()

        # Viewer under test
        self.a = nxv.GraphCanvas(G,
                                 EdgeTokenClass=nxv.TkPassthroughEdgeToken,
                                 NodeTokenClass=nxv.TkPassthroughNodeToken)
コード例 #3
0
    def setUp(self):
        # Create the graph for testing
        G = nx.Graph()
        G.add_edge('a', 2)
        G.add_edge(2, 'c')
        G.add_edge('a', 'c')
        G.add_edge('a', 4)
        G.add_edge(4, 'c')
        G.add_edge('out', 'c')
        G.add_edge('c', 'd')
        G.add_edge('d', 2)
        # Growth edges
        G.add_edge('out', 11)
        G.add_edge('out', 12)
        G.add_edge(12, 'd')
        G.add_edge('TTTTT', 11)
        G.add_edge('qqqq', 'TTTTT')
        G.add_node('alone')
        self.input_G = G.copy()

        # Viewer under test
        self.a = nxv.GraphCanvas(G)
コード例 #4
0
    def setUp(self):
        super(TestGraphCanvasFiltered, self).setUp()
        # Modify graph to include a "real" on all existing nodes which
        # evaluates to True when we we will filter by them
        G = self.a.dataG

        for n in G.nodes():
            G.nodes[n]['real'] = True

        # Now we're going to add a couple of "fake" nodes; IE, nodes
        #  that should be not be displayed because they are not in the filter.
        #  If they do show up, they'll cause us to fail some of the base checks
        G.add_edge('out', 'fake1')
        G.add_edge('a', 'fake2')
        G.add_edge('qqqq', 'fake3')
        G.add_edge('fake3', 'fake4')
        G.add_node('fake_alone')

        # Viewer under test
        self.a = nxv.GraphCanvas(G)
        self.input_G = G
        #gself.filter_lambda = "not str(u).startswith('fake')"
        self.filter_lambda = "d.get('real',False)"
        self.a.add_filter(self.filter_lambda)