當前位置: 首頁>>代碼示例>>Python>>正文


Python networkx.fruchterman_reingold_layout方法代碼示例

本文整理匯總了Python中networkx.fruchterman_reingold_layout方法的典型用法代碼示例。如果您正苦於以下問題:Python networkx.fruchterman_reingold_layout方法的具體用法?Python networkx.fruchterman_reingold_layout怎麽用?Python networkx.fruchterman_reingold_layout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在networkx的用法示例。


在下文中一共展示了networkx.fruchterman_reingold_layout方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_smoke_int

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_int(self):
        G = self.Gi
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.planar_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.fruchterman_reingold_layout(self.bigG)
        vpos = nx.spectral_layout(G)
        vpos = nx.spectral_layout(G.to_directed())
        vpos = nx.spectral_layout(self.bigG)
        vpos = nx.spectral_layout(self.bigG.to_directed())
        vpos = nx.shell_layout(G)
        if self.scipy is not None:
            vpos = nx.kamada_kawai_layout(G)
            vpos = nx.kamada_kawai_layout(G, dim=1) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:18,代碼來源:test_layout.py

示例2: test_empty_graph

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_empty_graph(self):
        G = nx.empty_graph()
        vpos = nx.random_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.circular_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.planar_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.bipartite_layout(G, G)
        assert_equal(vpos, {})
        vpos = nx.spring_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.fruchterman_reingold_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.spectral_layout(G, center=(1, 1))
        assert_equal(vpos, {})
        vpos = nx.shell_layout(G, center=(1, 1))
        assert_equal(vpos, {}) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:20,代碼來源:test_layout.py

示例3: test_smoke_int

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_int(self):
        G = self.Gi
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.fruchterman_reingold_layout(self.bigG)
        vpos = nx.spectral_layout(G)
        vpos = nx.spectral_layout(G.to_directed())
        vpos = nx.spectral_layout(self.bigG)
        vpos = nx.spectral_layout(self.bigG.to_directed())
        vpos = nx.shell_layout(G)
        if self.scipy is not None:
            vpos = nx.kamada_kawai_layout(G) 
開發者ID:aws-samples,項目名稱:aws-kube-codesuite,代碼行數:16,代碼來源:test_layout.py

示例4: test_smoke_int

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_int(self):
        G=self.Gi
        vpos=nx.random_layout(G)
        vpos=nx.circular_layout(G)
        vpos=nx.spring_layout(G)
        vpos=nx.fruchterman_reingold_layout(G)
        vpos=nx.spectral_layout(G)
        vpos=nx.spectral_layout(self.bigG)
        vpos=nx.shell_layout(G) 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:11,代碼來源:test_layout.py

示例5: test_smoke_string

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_string(self):
        G = self.Gs
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.spectral_layout(G)
        vpos = nx.shell_layout(G) 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:10,代碼來源:test_layout.py

示例6: test_empty_graph

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_empty_graph(self):
        G=nx.Graph()
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.shell_layout(G)
        vpos = nx.spectral_layout(G)
        # center arg
        vpos = nx.random_layout(G, scale=2, center=(4,5))
        vpos = nx.circular_layout(G, scale=2, center=(4,5))
        vpos = nx.spring_layout(G, scale=2, center=(4,5))
        vpos = nx.shell_layout(G, scale=2, center=(4,5))
        vpos = nx.spectral_layout(G, scale=2, center=(4,5)) 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:16,代碼來源:test_layout.py

示例7: test_single_node

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_single_node(self):
        G = nx.Graph()
        G.add_node(0)
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.shell_layout(G)
        vpos = nx.spectral_layout(G)
        # center arg
        vpos = nx.random_layout(G, scale=2, center=(4,5))
        vpos = nx.circular_layout(G, scale=2, center=(4,5))
        vpos = nx.spring_layout(G, scale=2, center=(4,5))
        vpos = nx.shell_layout(G, scale=2, center=(4,5))
        vpos = nx.spectral_layout(G, scale=2, center=(4,5)) 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:17,代碼來源:test_layout.py

示例8: test_spring_init_pos

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_spring_init_pos(self):
        # Tests GH #2448
        import math
        G = nx.Graph()
        G.add_edges_from([(0, 1), (1, 2), (2, 0), (2, 3)])

        init_pos = {0: (0.0, 0.0)}
        fixed_pos = [0]
        pos = nx.fruchterman_reingold_layout(G, pos=init_pos, fixed=fixed_pos)
        has_nan = any(math.isnan(c) for coords in pos.values() for c in coords)
        assert_false(has_nan, 'values should not be nan') 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:13,代碼來源:test_layout.py

示例9: test_smoke_empty_graph

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_empty_graph(self):
        G = []
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.planar_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.spectral_layout(G)
        vpos = nx.shell_layout(G)
        vpos = nx.bipartite_layout(G, G)
        if self.scipy is not None:
            vpos = nx.kamada_kawai_layout(G) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:14,代碼來源:test_layout.py

示例10: test_smoke_string

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_string(self):
        G = self.Gs
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.planar_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.spectral_layout(G)
        vpos = nx.shell_layout(G)
        if self.scipy is not None:
            vpos = nx.kamada_kawai_layout(G)
            vpos = nx.kamada_kawai_layout(G, dim=1) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:14,代碼來源:test_layout.py

示例11: test_smoke_initial_pos_fruchterman_reingold

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_initial_pos_fruchterman_reingold(self):
        pos = nx.circular_layout(self.Gi)
        npos = nx.fruchterman_reingold_layout(self.Gi, pos=pos) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:5,代碼來源:test_layout.py

示例12: test_center_parameter

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_center_parameter(self):
        G = nx.path_graph(1)
        vpos = nx.random_layout(G, center=(1, 1))
        vpos = nx.circular_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1))
        vpos = nx.planar_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1))
        vpos = nx.spring_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1))
        vpos = nx.fruchterman_reingold_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1))
        vpos = nx.spectral_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1))
        vpos = nx.shell_layout(G, center=(1, 1))
        assert_equal(tuple(vpos[0]), (1, 1)) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:17,代碼來源:test_layout.py

示例13: test_center_wrong_dimensions

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_center_wrong_dimensions(self):
        G = nx.path_graph(1)
        assert_raises(ValueError, nx.random_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.circular_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.planar_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.spring_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.fruchterman_reingold_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.fruchterman_reingold_layout, G, dim=3, center=(1, 1))
        assert_raises(ValueError, nx.spectral_layout, G, center=(1, 1, 1))
        assert_raises(ValueError, nx.spectral_layout, G, dim=3, center=(1, 1))
        assert_raises(ValueError, nx.shell_layout, G, center=(1, 1, 1)) 
開發者ID:holzschu,項目名稱:Carnets,代碼行數:13,代碼來源:test_layout.py

示例14: auto_layout

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def auto_layout(self):
        """
        Automatic layout of the nodes
        """

        if self.circuit.graph is None:
            self.circuit.compile_snapshot()

        pos = nx.spectral_layout(self.circuit.graph, scale=2, weight='weight')

        pos = nx.fruchterman_reingold_layout(self.circuit.graph, dim=2,
                                             k=None, pos=pos, fixed=None, iterations=500,
                                             weight='weight', scale=20.0, center=None)

        # assign the positions to the graphical objects of the nodes
        for i, bus in enumerate(self.circuit.buses):
            try:
                x, y = pos[i] * 500
                bus.graphic_obj.setPos(QPoint(x, y))

                # apply changes to the API objects
                bus.x = x
                bus.y = y

            except KeyError as ex:
                warn('auto_layout: Node ' + str(i) + ' not in the graph!!!! \n' + str(ex))

        self.center_nodes() 
開發者ID:SanPen,項目名稱:GridCal,代碼行數:30,代碼來源:editor.py

示例15: test_smoke_empty_graph

# 需要導入模塊: import networkx [as 別名]
# 或者: from networkx import fruchterman_reingold_layout [as 別名]
def test_smoke_empty_graph(self):
        G = []
        vpos = nx.random_layout(G)
        vpos = nx.circular_layout(G)
        vpos = nx.spring_layout(G)
        vpos = nx.fruchterman_reingold_layout(G)
        vpos = nx.spectral_layout(G)
        vpos = nx.shell_layout(G)
        if self.scipy is not None:
            vpos = nx.kamada_kawai_layout(G) 
開發者ID:aws-samples,項目名稱:aws-kube-codesuite,代碼行數:12,代碼來源:test_layout.py


注:本文中的networkx.fruchterman_reingold_layout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。