Hi there,
After trying four other force-directed graph layout implementations, I was
very happy to find graph-tool's sfdp_layout, which easily handles graphs
with O(10^6) nodes while still offering a number of layout customizations.
I'd like to better understand the intended effects of some of the
sfdp_layout parameters. I've included below a script featuring a toy graph
that I've been experimenting with. It seems that increasing C -- the
relative strength of repulsive force -- doesn't have any effect on the
layout. Meanwhile, increasing mu -- the strength of the attractive force --
seems to /reduce/ vertex clustering.
Any insight into this behavior? Am I misunderstanding the documentation?
Thanks,
Pete
-------------------------
import graph_tool.all as gt
# specify graph as a sparse matrix
garray = [(0, 1, 0.9),
(0, 2, 0.9),
(0, 4, 0.8),
(0, 5, 0.8),
(1, 2, 0.9),
(2, 3, 0.6),
(3, 6, 0.6),
(4, 7, 0.8),
(4, 8, 0.8),
(4, 9, 0.8),
(4, 10, 0.8),
(5, 6, 0.7),
(7, 8, 0.8),
(7, 9, 0.8),
(7, 10, 0.8),
(8, 9, 0.8),
(8, 10, 0.8),
(9, 10, 0.8)]
# get number of vertices
N = max(line[1] for line in garray) + 1
# initialize graph and vertices
g = gt.Graph(directed = False)
g.add_vertex(N)
# initialize edge property for weights
weights = g.new_edge_property('double')
# construct edges
for line in garray:
edge = g.add_edge( g.vertex(line[0]), g.vertex(line[1]) )
weights[edge] = line[2]
# compute vertex positions
# eweight = None edge weights
# C = 0.2 relative strength of repulsive forces
# K = None optimal edge length
# p = 2 repulsive force exponent
# gamma = 1.0 strength of attractive force between connected
components, or group assignments
# mu = 0.0 strength of attractive force between vertices of the
same connected component, or group assignment
# mu_p = 1.0 scaling exponent of attractive force between
vertices of the same connected component, or group assignment
pos = gt.sfdp_layout(g, eweight = weights, C = 0.2, K = None, p = 2, gamma =
1.0, mu = 0.0, mu_p = 1.0)
# generate figure
gt.graph_draw(g, pos, vertex_text = g.vertex_index, output_size = (200,
200), output = 'graph.png')
--
View this message in context:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/sfdp-layout-force-parameters-tp4026014.html
Sent from the Main discussion list for the graph-tool project mailing list
archive at Nabble.com.
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool