Skip to content

Tag: networkx

Fill color in single cells in a networkx graph

I’ve build a graph with networkx, that looks like this: Graph I want to fill every singel cell with a specified color. The Graph was drawn by nx.draw_networkx_edges() (returns a LineCollection). I found a similar question here (Fill area between lines), but the solution in the comments, doesn’t wo…

Degeneracy given a graph

An exercise requires to determine the degenerative level of a graph. To do that, I have found useful the following code (source: https://www.geeksforgeeks.org/find-k-cores-graph/) which represents an undirected graph using adjacency list representation An example of data that I am using for building a graph i…

Plotting subgraphs identified by connected components

I have detected connected components in my graph. Now I would need to plot them in separate charts for analyzing them individually.As example I am using karate club network, but my network has actually 5 connected components. I used nx.draw but nothing has been displayed: Answer S is not a subgraph but a list…

How can I connect two portion of my graph? in python

Hi all I have a graph which is split in two portion, like I am showing in the photo, I would like to connect the two portion by adding a red edges like I am showing in the photo. Someone know a networkx function to do that? Answer If you do not have to calculate anything else (meaning the nodes