networkx

Pytorch Geometric: 'from_networkx' doesn't work with my 'group_node_attrs'

Pytorch Geometric: 'from_networkx' doesn't work with my 'group_node_attrs' Question: I’ trying to convert a NetwrokX graph into the pyg format to feed it to a GCN. from_networkx(G) works without problems from_networkx(G, group_node_attrs=x) # doesn’t work, and I get the following error: Here the documentation about how the function ‘from_networkx’: https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/utils/convert.html Traceback (most recent call last): …

Total answers: 1

Set z-order of Edges in Pandas Dataframe

Set z-order of Edges in Pandas Dataframe Question: I’m using OSMnx to create some plots of road networks with data shown by colour, below is an example which produces an image with colour showing betweenness centrality. The problem I’m having is that, due to the zordering, some of the lighter regions are covered by other …

Total answers: 2

How to get an isomorphic graph from another in networkx?

How to get an isomorphic graph from another in networkx? Question: Good morning, everyone. I am currently doing a unit test of a function that processes graphs and it should give similar results in front of isomorphic graphs. So, I would like to output only an isomorphic graph from a networkx graph, but I can’t …

Total answers: 1

Ignore non-connected nodes in NetworkX Graph

Ignore non-connected nodes in NetworkX Graph Question: I have a network diagram where a node is connected to another node which in-turn is connected to another node, worked through a logic to ignore when there is only one neighbour but that is still leaving few bits back. The attached diagram does a better job explaining …

Total answers: 1

Unable to embed networkx graph using matplotlib in customtk

Unable to embed networkx graph using matplotlib in customtk Question: I’m trying to embed a networkx graph in CustomTk, but the graph doesn’t appear. When I use plt.show() I can see the graph in matplotlib pop-up menu, but not in GUI. import tkinter import customtkinter import networkx as nx from matplotlib.backends.backend_tkagg import ( FigureCanvasTkAgg, NavigationToolbar2Tk) …

Total answers: 1

Get weight combining edges in Networkx

Get weight combining edges in Networkx Question: Hello I am using Networkx with Python to make some graphs. After extracting the edges from a .CSV structured as "source" and "target" I got a list of edges like this: edges = [(a,b), (a,c), (b,c), (a,b), (a,b), (a,c)] Is there any way to build ( after creating …

Total answers: 1

Networkx: select nodes only if they have a given attribute

Networkx: select nodes only if they have a given attribute Question: Here is a sample graph based on the code of a previous question ("How can I select nodes with a given attribute value"): import networkx as nx P = nx.Graph() P.add_node("node1", at=5) P.add_node("node2", at=5) P.add_node("node3", at=6) # You can select like this selected_data = …

Total answers: 1

networkx: Assigning node colors based on weight when using bbox

networkx: Assigning node colors based on weight when using bbox Question: I want to draw a graph with networx and render the nodes as boxes wide enough to contain each node’s name, colored according to its weight. If I use the default shape, they are colored correctly, but when I use the bbox parameter facecolor, …

Total answers: 1

NetworkX graph with some specifications based on two dataframes

NetworkX graph with some specifications based on two dataframes Question: I have two dataframes. The first shows the name of people of a program, called df_student. Student-ID Name 20202456 Luke De Paul 20202713 Emil Smith 20202456 Alexander Müller 20202713 Paul Bernard 20202456 Zoe Michailidis 20202713 Joanna Grimaldi 20202456 Kepler Santos 20202713 Dominic Borg 20202456 Jessica …

Total answers: 1

networkX DiGraph: list all neighbouring nodes disregarding edge direction

networkX DiGraph: list all neighbouring nodes disregarding edge direction Question: Is there a better way to obtain the list of nodes that connect to a given one in a directed graph via a single edge (whether inbound or outbound)? Here is what I came up with. First I build and draw a demo DiGraph: import …

Total answers: 2