I would like to announce a new package for the Graphs ecosystem of julia:
NestedGraphs.jl
.
As the name suggests, the package provides a way to handle nested graphs.
It’s meant to offer type-stable support, although some type-instabilities are lurking, which I still didn’t have the time to tackle.
I have yet to find another package in any programming language that implements nested graphs, so please mention if you know any. It would be nice to know about any future benchmarks.
Design
The basic idea is that every NestedGraph
has a representation of a flat graph flatgr
, which is created by merging all involved subgraphs into a single graph. This way, you can easily call all your favorite Graphs.jl
functions using this field. Moreover, there is a nested representation through which all subgraphs can be accessed. (This actually means that there is a need for 2x the space requirements).
A NestedGraph
can have a recursive structure by stacking many NestedGraph
s.
The real effort behind NestedGraphs
is actually synchronizing the flat graph with all the subgraphs when modifications/additions/removals of vertices, edges, subgraphs, and properties take place.
Wherever I saw possible, I used a shallow-reference, not only for saving memory space but mostly for easy updates. For example, with shallow references, changing the property of a node in the flat graph will automatically change the property also in the subgraph.
Future plans
There are also the following packages underway.
- NestedGraphsIO.jl
Read and write aNestedGraph
using graphml. Supports also attributes, i.e., aMetaGraph
orNestedGraph{MetaGraph}
. - NestedGraphMakie.jl
Implementsngraphplot()
to visualize nested graphs. However, for now, it’s very very basic.