networkx

What is the correct graph data structure to differentiate between nodes with the same name?

廉价感情. 提交于 2021-02-20 05:14:13
问题 I'm learning about graphs(they seem super useful) and was wondering if I could get some advice on a possible way to structure my graphs. Simply, Lets say I get purchase order data everyday and some days its the same as the day before and on others its different. For example, yesterday I had an order of pencils and erasers, I create the two nodes to represent them and then today I get an order for an eraser and a marker, and so on. After each day, my program also looks to see who ordered what,

Minimize crossings in a radial graph (networkx, graphviz)

本秂侑毒 提交于 2021-02-19 06:29:29
问题 I have a complicated graph that I build using the python networkx library and I am trying to draw it in an understandable way. My data is structured in a way that I always have a central node, then a set of nodes that are at distance 1 from the center, and then another set of nodes which are at distance 2 from the center. By "distance" I mean the minimum number of edges before reaching the central node. Because of this structure, I would like to draw the graph in a radial fashion, where the

how can i choose image/picture for my nodes in gexf or networkx

本秂侑毒 提交于 2021-02-19 04:26:48
问题 my project's aim is to generate a network diagram, I've made a program that creates objects as swicth and nodes in python then it generates a gexf file and my question is : Can everybody tell me if he knows a way that allow us to choose a node image by using gexf, networkx or other tools. Thank you so much 回答1: NetworkX supports adding any form of data as attributes for a node such as an image: G=nx.Graph() G.add_edge(0,1, image=my_img) Essentially everything is stored as a dictionary

Pygraphviz xlabel position and color doesn't work

风格不统一 提交于 2021-02-19 04:18:37
问题 I am using pygraphviz to create graphs for my project. I am unable to figure out how to center the xlabel of nodes and also how to change the color of xlabel. graph.add_node(row[3], color='goldenrod2', style='filled', shape='box', xlabel=round(self.pi_dict.get(row[3]), 2), fontname='calibri') I tried using xlp='10,10!' and xlabelfontcolor='red' . Both attributes don't seem to work. Where am I going wrong. As you can see in the attached fig. above, the xlabel is positioned by default towards

Pygraphviz xlabel position and color doesn't work

廉价感情. 提交于 2021-02-19 04:15:16
问题 I am using pygraphviz to create graphs for my project. I am unable to figure out how to center the xlabel of nodes and also how to change the color of xlabel. graph.add_node(row[3], color='goldenrod2', style='filled', shape='box', xlabel=round(self.pi_dict.get(row[3]), 2), fontname='calibri') I tried using xlp='10,10!' and xlabelfontcolor='red' . Both attributes don't seem to work. Where am I going wrong. As you can see in the attached fig. above, the xlabel is positioned by default towards

NetworkX - How to create MultiDiGraph from Shapefile?

梦想的初衷 提交于 2021-02-18 19:25:30
问题 I'm just picking up NetworkX and trying to learn how to use it with Shapefiles. Right now I have a .shp with a road network that I want to represent in a Graph with NetworkX, so that I can find the shortest path between 2 GPS points. I tried using this, but the problem is that when I run the write_shp() function I lose edges because DiGraph does not allow more than one edge between the same two nodes. The arrow in the figure below shows an example of an edge I lose by using a DiGraph. So I

NetworkX - How to create MultiDiGraph from Shapefile?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-18 19:24:08
问题 I'm just picking up NetworkX and trying to learn how to use it with Shapefiles. Right now I have a .shp with a road network that I want to represent in a Graph with NetworkX, so that I can find the shortest path between 2 GPS points. I tried using this, but the problem is that when I run the write_shp() function I lose edges because DiGraph does not allow more than one edge between the same two nodes. The arrow in the figure below shows an example of an edge I lose by using a DiGraph. So I

Deleting nodes with tie=1 in a large NetworkX graph

≯℡__Kan透↙ 提交于 2021-02-18 19:11:35
问题 I have made large graph with NetworkX with about 20,000 nodes. I would like to delete nodes with only one tie (or zero ties) to try to reduce the clutter. Since it is a very large graph I do not know the nodes by name or ID that have tie=1 or 0. Does anyone know how to delete these nodes without specifying the node ID or name? 回答1: Iterating on a Graph g yields all of g 's nodes, one at a time -- I believe you can't alter g during the iteration itself, but you can selectively make a list of

Deleting nodes with tie=1 in a large NetworkX graph

扶醉桌前 提交于 2021-02-18 19:10:39
问题 I have made large graph with NetworkX with about 20,000 nodes. I would like to delete nodes with only one tie (or zero ties) to try to reduce the clutter. Since it is a very large graph I do not know the nodes by name or ID that have tie=1 or 0. Does anyone know how to delete these nodes without specifying the node ID or name? 回答1: Iterating on a Graph g yields all of g 's nodes, one at a time -- I believe you can't alter g during the iteration itself, but you can selectively make a list of

Deleting nodes with tie=1 in a large NetworkX graph

扶醉桌前 提交于 2021-02-18 19:10:10
问题 I have made large graph with NetworkX with about 20,000 nodes. I would like to delete nodes with only one tie (or zero ties) to try to reduce the clutter. Since it is a very large graph I do not know the nodes by name or ID that have tie=1 or 0. Does anyone know how to delete these nodes without specifying the node ID or name? 回答1: Iterating on a Graph g yields all of g 's nodes, one at a time -- I believe you can't alter g during the iteration itself, but you can selectively make a list of