I would like to use graph tool subpackage : minimize_blockmodel_dl
https://graph-tool.skewed.de/static/doc/inference.html#graph_tool.inference.minimize_blockmodel_dl to find communities in a network.
I write code like this:
state = gt.minimize_blockmodel_dl(G). G is the graph containing nodes and edges. I wonder how can I do next to get the specific communities?
I'm not sure why my network graph doesn't include edges.
I'm creating a network from a pandas dataframe that looks like the following:
I created the network as follows:
G = nx.from_pandas_edgelist(network_df,
edge_attr='weight',
source='Source',
target='Target',
create_using=nx.Graph())
but nx.draw(G) produces a graph without edges.
I tried using nx.DigGraph() but the result is the same.
Any help is greatly appreciated.
That central "blob" in your plot is a lot of nodes connected together which probably do have edges, but they are obscured by the dense mass of nodes. On the periphery there are a few nodes joined together by edges, but due to the plotting algorithm they pairs (or somewhat larger cluster) are again so close together that the nodes are obscured. The isolated nodes are isolated.
It's probably best to try another layout. The default is spring_layout. Here's another that will probably show it better:
pos = nx.circular_layout(G)
nx.draw(G, pos)
As a general rule, networkx was not designed for the purpose of graph visualization. So you may need to look at other tools like graphviz.
I would like to visually group a set of nodes in networkx. Of course one could do so by changing node color, size etc. My preferred solution however should look something like the plot created with igraph below. Is this possible in networkx?
Could anyone help me with generating graphs of predetermined assortativity using networkx? I want to show as an example that two networks with the same density and average centrality can have very different assortativities. Is there any way of generating these graphs using networkx? Thanks, Rajat.
I am using networkx to visualize a graph, I want to draw something like the attached figure. All the small connected components are align below the major components, anyone know how to do it with networkx or other python package? Thanks a lot