September 2018
Intermediate to advanced
288 pages
7h 38m
English
Python has no built-in data type or class for representing graphs, but it is easy to implement them. Data structures are ideal for representing graphs in Python, for example, it is very simple to implement them through dictionaries.
Dictionaries are associative arrays, therefore objects that are substantially similar to arrays but that use different indices. In fact, unlike lists that use only whole numbers, dictionaries can adopt as indices any Python object as long as it's immutable, for example, strings, tuples, and numbers. We will then be able to use the key-value structure of dictionaries to represent any graph, using as few lines of code as possible.
Dictionaries represent only one of the data structures ...
Read now
Unlock full access