The goal of LightGraphs.jl is to offer a performant platform for network and graph analysis in Julia. To this end, LightGraphs offers both (a) a set of simple, concrete graph implementations –
SimpleGraph (for undirected graphs) and
SimpleDiGraph (for directed graphs), and (b) an API for the development of more sophisticated graph implementations under the
As such, LightGraphs.jl is the central package of the JuliaGraphs ecosystem. Additional functionality like advanced IO and file formats, weighted graphs, property graphs, and optimization related functions can be found in the following packages:
- LightGraphsExtras.jl: extra functions for graph analysis.
- MetaGraphs.jl: graphs with associated meta-data.
- SimpleWeightedGraphs.jl: weighted graphs.
- GraphIO.jl: tools for importing and exporting graph objects using common file types like edgelists, GraphML, Pajek NET, and more.
- GraphDataFrameBridge.jl: Tools for converting edgelists stored in DataFrames into graphs (
Basic library examples
The LightGraphs.jl libraries includes numerous convenience functions for generating functions detailed in Making and Modifying Graphs, such as
PathGraph, which makes a simple undirected path graph of a given length. Once created, these graphs can be easily interrogated and modified.
julia> g = PathGraph(6) # Number of vertices julia> nv(g) # Number of edges julia> ne(g) # Add an edge to make the path a loop julia> add_edge!(g, 1, 6)
For an overview of basic functions for interacting with graphs, check out Accessing Graph Properties and Making and Modifying Graphs. Detailed tutorials may be found in the JuliaGraphs Tutorial Notebooks repository.