networkx to show traffic help to get started - Printable Version +- Python Forum ( https://python-forum.io)+-- Forum: Python Coding ( https://python-forum.io/Forum-Python-Coding)+--- Forum: Data Science ( https://python-forum.io/Forum-Data-Science)+--- Thread: networkx to show traffic help to get started ( /Thread-networkx-to-show-traffic-help-to-get-started) |

networkx to show traffic help to get started - paul41 - Nov-23-2019
I am going to be using both networkx and matplotlib to produce a graph. The graph data input is 'currently' in the format of a dictionary. The dictionary comes in the following format: Dict = {A > B: 1, A > C: 2, C > D: 3} The letters respresenting the nodes. So above it means that A connects to B and A also connects to C... The numbers actually represent a count, so my end goal is to produce thicker lines for a higher count or possibly a different colour based on the final look of the graph. I'm just looking for a starting point. The dictionary is large and i have only given a very small sample as an example. My questions: 1. Is there a way to use the dictionary in its present form with network x? 2. Should I look to convert the dictionary keys and split this out into a list format for example: (A, B), (A,C), (C,D). I think I can work out how to create the nodes and edges if it is in this format. However, if I go down this route I am not sure how I will be able to relate each connection as a count to create the thickness of the lines. So say A > B has a count of 1 and A to C has a count of C. Any help in getting me started would be much appreciated. I'm hoping you understand what I am trying to do :-) |