本文整理汇总了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)
示例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, {})
示例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)
示例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)
示例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)
示例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))
示例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))
示例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')
示例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)
示例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)
示例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)
示例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))
示例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))
示例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()
示例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)