Drawing a large network using Julia

Is there a way to draw a network (with nods and edges) in Julia? In particular, I have (say) 5 nodes of type 1 and 10 of type 2. Directed edges exist from each type 1 node to type 2 node, and I would probably show nodes of each type using different colors. For now, they can be located randomly on a 2D plane. Can a code be written using loops or something similar that would save me time to do this in PowerPoint etc.? Also, with a large number of nodes, I would want to automate it. Maybe there is a package that does this already. Any help is appreciated. Thanks!

Graphs.jl is a good package for constructing graphs. You can build them in various ways, by adding vertices and edges, from matrices, etc.

For drawing graphs, there are a number of packages that display graphs made with Graphs.jl:

5 Likes

It might make sense to just export the network to one of the usual graph formats, like DOT or GML or GraphML (different from GML).

For example, DOT syntax originated with the venerable Unix (and crossplatform, nowadays) graph drawing tool: GraphViz. GraphViz is useful for 2D noninteractive drawing of graphs:

On the other hand, if you’re dealing with really large graphs you should check out the Graphia program, it accepts most of the standard graph formats (including the ones mentioned above), and it amazingly successfully visualizes huge networks in 3D, with a GUI and various options for customization and graph transformation. Interactively drawn networks with millions of nodes; with panning, zooming, etc. Graphia’s homepage and Github:

2 Likes

Thanks. I will take a look into these. :slight_smile:

1 Like

These are some amazing references. I will see which one works the best for me. Thanks a lot! :slight_smile:

1 Like

@nsajko Is there an easy way to turn a matrix or graph in Julia into something useable by Graphia?

GML is nice and simple to generate, here’s an example directed graph with two vertices and one edge:

graph [
  directed 1
  
  node [
    id 1
    label "A"
  ]
  node [
    id 2
    label "B"
  ]

  edge [
    source 1
    target 2
  ]
]

What format is your data in?