Networkx graph with fixed assortativity - python

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.

Related

Drawing a directed graph with NetworkX by overlapping minimum edges

I'm trying to draw a directed graph in python with networkx
It uses Fruchterman-Reingold force-directed algorithm to position nodes. However, I couldn't get a result of graph with minimum overlapping edges. I want something like this in NetworkX or some other python API.
Can Fruchterman-Reingold algorithm produce a graph with minimum overlapping edges? If it can, which parameter should I adjust? If it can not, is there any API or alogrithm to use in python?
My code to visualize
pos = nx.spring_layout(G, k=100, iterations=500, seed=1)
Let me know if you need more info.!
Thanks!

How to connect nodes in a networkx graph?

Left is input, right is desired output:
Input: I am given some n. I generate n points uniformly at random from [0, 1]. So, the points are tuples (x, y).
I then add this list of nodes into NetworkX graph object. Now, I'd like to connect the edges as shown in the right. That is, the graph is connected (you can get from anywhere to anywhere using some number of edges) but not necessarily an Erdos Renyi graph.
I'm not sure what the term is for this kind of graph - no overlapping edges graph? but is it possible to generate edges for such a graph using Networkx?
Networks derived from points in Euclidean space are typically called geometric graphs. Graphs with no overlapping edges are called planar graphs. As you have drawn all your edges as straight lines, I assume that you are particularly interested in planar, straight-line graphs (PSLGs).
There are several generators for geometric graphs in networkx, however, I am unsure if any of them would necessarily honor the planarity constraint (it feels that you could coerce the geographical_treshold_graph to do that if you picked the threshold parameter in an intelligent way but I don't have a solution off the top of my head).
Personally, I would start with my random points, and then get the edges by computing a Delaunay triangulation, implemented in scipy.spatial. I would then subsample the edges (depending on the task) and create my graph objects in networkx/igraph/graph-tool.

Visualising directed hyperedges in network graph Python

I'm trying to visualise a multi-edge directed graph, with hyper-edges. I've looked into python NetworkX, I'm starting with the directed graph, which can basically give me this:
But I would like to visualise my edges combined (since they are a kind of "bundle", with multiple source vertices, and one destination vertex).
Like this:
Any help would be appreciated.

Can I use the HITS Link Analysis Algorithm in NetworkX Python Library on a undirected weighted graph?

I want to know if I can use the HITS link analysis algorithm in NetworkX on an undirected weighted graph. Following which I wish to sort in descending order the hub score of the nodes in the graph.
Did you read the docstring for the function?
The HITS algorithm was designed for directed graphs but this
algorithm does not check if the input graph is directed and will
execute on undirected graphs.
So yes, you can use it.

Python networkx Drawing overlay subgroups in a graph

I am wondering if it is possible to create a graph using python and possibly networkx, overlaid subgraphs having different colors? These subgraphs are cluster of nodes. An example of such graph can be found at:
http://www.barabasilab.com/pubs/CCNR-ALB_Publications/200904-10_PLoSCompBio-HumanPhenotypes/200904-10_PLoSCompBio-Fig2sm.png

Categories

Resources