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/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 25.02.2015 00:57, pete wrote:
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?
The SFDP algorithm is indeed difficult to control precisely, since it depends non-trivially on the actual structure of the graph. The parameter C indeed does not produce a visible difference, but you can see that the actual _values_ of the positions do change... You should get a more spread-out layout (in absolute values) for larger values of C. The same holds for the parameter K: the "optimal edge length". These change the scale of the positions, but not the actual visible layout. The only way to visibly alter the layout is via the parameter p (the repulsive force exponent), and the eweight properties. The latter will provide a different layout only if the weight values are very different for each edge. I think you are indeed misunderstanding the role of the parameter mu. It only comes into play when you have disconnected graphs, or when you have specified group assignments (via the 'groups' parameters). The purpose of the groups + mu is to force groups of vertices to be closer in the layout. When you leave 'groups' alone, but change 'mu', the effect is that you add an additional global _attractive_ force between all nodes in the graph, and hence you get the effect you are seeing: A reduced clustering. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
pete -
Tiago de Paula Peixoto