NetworkX 3.0 - create, manipulate, and study complex networks in Python
networkx.org
networkx.org
They allow me to define infrastructure build instructions as a dot file that looks similar to this. It's similar to an advanced makefile.
This segment of the infrastructure specification sets a dependency on the bastion box, the vault AMI (Amazon Machine Image) and web server provisioned by terraform on the source AMI. Then it sets a dependency of uploading nodejs to the repository server and a dependency on dpkg scan packages. It also tells machines to join themselves to a Kubernetes cluster.
digraph G {
label="pipeline";
rankdir=TB;
"packer/source-ami*" -> { "terraform/bastion";
"packer/vault-ami*";
"terraform/web"
}
"terraform/bastion" -> "@repository-upload/nodejs_12.13.1_amd64"
"terraform/repository" -> "@repository-upload/nodejs_12.13.1_amd64"
"@repository-upload/nodejs_12.13.1_amd64" -> "@shell/dpkg-scanpackages"
"terraform/web" -> "@ansible/kubernetes-join";
"terraform/bastion" -> "@ansible/kubernetes-join";
"terraform/services" -> "@ansible/kubernetes-join";
"@ansible/kubernetes" -> "@ansible/kubernetes-join";
...
}
Graph formats are really flexible and compact and I would like to see them used for more things.A topological search solves many problems.
So if there's two packer builds that do not depend on eachother, they can run in parallel since they are slow.
https://github.com/samsquire/devops-schedule https://github.com/samsquire/parallel-workers
Both make it easy to load/generate standard datasets, import tabular data, and have a good selection of plugins. It's easy to kick stuff out to either from NetworkX using /gefx or graphml, and you'll be able to experiment with a wide variety of layout algorithms and metrics. If you don't find the toy/benchmark networks intuitive, considering hitting the HN API for your source material; it's a lot easier to grasp the topic by studying relationships that are already familiar.
Here's a few useful references:
Good overview on big graphs: https://towardsdatascience.com/large-graph-visualization-too...
A gallery of large graphs - horrid user interface, but you can click through and find an absolute wealth of resources. Curated by Yifan Hu, who developed one of the popular layout algorithms: http://yifanhu.net/GALLERY/GRAPHS/
Graphviz is a very well-documented library with a lot of the 'classic' layouts.
Astronomy, physics, and bio people have a lot of useful visualization tools and techniques for huge datasets, but you will have to go looking for them - not because they don't like to share, but because they mostly write to each other so you won't just land on stuff by browsing Github. Absolute must-have literature review: https://arxiv.org/abs/2110.01866
A lot of large graph visualization techniques are about using simple graph visualization techniques but first combing out the hairballs through the application of dimensionality reduction, motif extraction, backbone identification and so on. This is an important paper whose techniques have yet to be fully explored: https://jgaa.info/accepted/2015/NocajOrtmannBrandes2015.19.2...
For a combination of theoretical and practical reasons, most visualization zeroes in on rendering smallish graphs in 2 dimensions. Large graphs are either so densely connected as to be be intractable (the brain being the ultimate hairball) or so sparse as be like digital planetariums - gorgeous, impressive, and looking much the same in every direction.
I could go on at length but as you can maybe guess I'm a consumer of other people's research rather than an expert in implementing the fundamentals. Also I don't have any academic background whatsoever so I apologize for the haphazard infodump. I've been studying/applying stuff from this field for ~15 years but it's too out there for most people. Feel free to email though.
Would you mind elaborating on the work you do with graph visualisation?
Thank you for the offer, I'll certainly contact you after I familiarise myself with some more classic research material.
It's thrilling someone else noticed the Nocaj et al. Simmelian backbone paper. There is a directory somewhere on this computer of an implementation in graphviz that Emden Gansner wrote a couple of years ago. (It should at least be uploaded to graphviz gitlab so we don't ever lose it.) All we need now is a summer intern to finish the job. Sometimes it's natural to miss Bell Labs and even AT&T Labs a whole lot.
I compare it to something like Django or scikit-learn, which seem insanely dense and difficult to understand even as an experienced dev, and there are so many people working on them that it's hard to find easy but non-trivial contributions for a beginner to make.
Imo the best thing is to have a mentor who hopefully can find a reasonable thing to improve/add/fix and can help calm your nerves (submitting a pull request can be kinda scary haha). With NetworkX, in the past there were a lot of minor inefficiencies (things like materializing a list comprehension when you don't need to, etc) that are 1) easy to understand 2) don't require in depth knowledge of graph theory 3) are generally applicable to all python code and 4) easy to measure the results. They aren't the flashiest contributions, but the people I've done it with (6 or 7 at this point) have all seemed to enjoy it.
To be clear, I'm _not_ affiliated with NetworkX, but if you are interested in trying it out, my contact info is in my profile. Feel free to reach out.
We also have some structured projects https://networkx.org/documentation/latest/developer/projects... but they are usually for programs like GSoC/Outreachy.
Feel free to start a discussion https://github.com/networkx/networkx/discussions if you are looking for something specific :)
[I am one of the NetworkX devs]
At some point it might really start to be more efficient to have tags for the posts
I originally left off a description because NetworkX is the library for doing graph things in Python and I kind of assumed people would know. While it's not the most performant or cutting edge, it's so well-established that everyone else aims for interface compatibility with it, much like pandas and tabular data.
It's pretty neat that they've decided to leverage this by opening up the backend, allowing more performant/application specific offerings like SNAP or CUgraph to do the heavy lifting.
Not everyone writes Python, and not all Python programmers have heard of this particular library.
The new title is fitting (it specifies what it's a Python library now).
Igraph and graph tool might have something to retort to that. Up until this update, they were far far faster too (and still likely are if you ignore the ability in this update to specify different backends)
It shows how to use the feature, some benchmarks, and how other graph libraries can become plugins to the NetworkX dispatching mechanism.
This slide shows some speedups when using the GraphBLAS [1] backend [2]:
https://i.postimg.cc/mr3mkKtx/100x-Faster-Network-X.png
[1] https://github.com/python-graphblas/python-graphblas
[2] https://github.com/python-graphblas/graphblas-algorithms
A great service that network programming systems provide, as highlighted in some of the comments here, is simply to provide a framework for integrating useful functions for operating or computing on networks so they can be delivered to a broad audience. To illustrate, in the land of tables, if I need to join two tables, and count rows or sort and show the top-N, I know what software on my computer does that. If I have a network and want to find a shortest path or do some other simple pattern matching on paths, and maybe show the result graphically, what am I supposed to use? It's really not clear.
And, in 2023, why not both? Applications need both tabular and network views of data, and in some ways they are not that different. That the popular relational data platforms have not already rushed in to fill this need give some reason to pause and consider the situation further or maybe is an argument that tables and networks should have similar importance.
From real life, maybe one issue is that the technology for computing on tables is pretty well understood and manageable, but there are a lot of sharp edges around combinatorial structures like networks. From a recent real-life example, say I just want to make an attributed network representing employees in a company, and match them for an internal project. Is this as easy as sorting rows in a table? Hardly. Can you even find a textbook pseudocode algorithm and code it in a graph query language that is recognizable as that algorithm? These look like tough problems. At least NetworkX and systems like it provide a framework to integrate those implementation for a developer audience.
If there is another method I'd like to hear about it.
If you want the graphblas API in python, https://github.com/python-graphblas/python-graphblas/ is the right place :)
I ended up writing my own approach that iterates through all pairs of paths but have been bothered since then that I couldn’t find a function in NetworkX to do this; I’m sure it probably exists but I don’t know the right terminology to search for it. Anyone know what this function might be called?
[0] https://networkx.org/documentation/stable/reference/generate...
NetworkX(pure python with dict as the data structure) itself will never be faster than any C++ based library (I think GraphLab doesn't even exist now?) but with the new experimental backend plugins, you should be able to use NetworkX API and dispatch the computation to more efficient backends like GraphBLAS, and hopefully CuGraph in the future (if you have GPUs). A bit more info: https://twitter.com/networkx_team/status/1612478129649459202