A graph library entirely written in Julia. Install it with
]add Erdos
Erdos implements some graph types a large number of algorithms to work with them. Moreover edge and vertex properties can be internally stored in some of the graph types (we call them networks). These features can also be exported to most common graph formats. Custom graph types can be defined inheriting from Erdos' abstract types.
julia> using Erdos
julia> g = Network(10, 20) # create erdos-renyi random network
julia> add_edge!(g, 1, 6); # add edge (1, 6) if it doesn't exists already
julia> eprop!(g, "w", e -> dst(e) - src(e)) # add edge property named "w"
Network(10, 20) with [] graph, [] vertex, ["w"] edge properties
julia> vprop!(g, "x", v -> rand()) # add vertex property named "x"
Network(10, 20) with [] graph, ["x"] vertex, ["w"] edge properties
julia> eprop(g, 1, 6, "w")
5
julia> vprop(g, 1, "x")
0.9016965075429149
julia> writenetwork("mygraph.graphml", g) # save graph and properties in .graphml format
Refer to the documentation to explore all the features of Erdos. Here is a comprehensive list of the implemente algorithms. (EE) denotes algorithms in the companion package ErdosExtras.
core functions: vertices and edges addition and removal, degree (in/out/all), neighbors (in/out/all)
maps dictionary like types to store properties associated to vertices and edges
networks store vertex/edge/graph properties (maps) inside the graph itself
connectivity: strongly- and weakly-connected components, bipartite checks, condensation, attracting components, neighborhood, k-core
operators: complement, reverse, reverse!, union, join, intersect, difference, symmetric difference, blockdiag, induced subgraphs, products (cartesian/scalar)
shortest paths: Dijkstra, Dijkstra with predecessors, Bellman-Ford, Floyd-Warshall, A*
graph datasets: A collection of real world graphs (e.g. Zachary's karate club)
graph generators: notorious graphs, euclidean graphs and random graphs (Erdős–Rényi, Watts-Strogatz, random regular, arbitrary degree sequence, stochastic block model)
I/O formats: graphml, gml, gexf, dot, net, gt. For some of these formats vertex/edge/graph properties can be read and written.
centrality: betweenness, closeness, degree, pagerank, Katz
traversal operations: cycle detection, BFS and DFS DAGs, BFS and DFS traversals with visitors, DFS topological sort, maximum adjacency / minimum cut, multiple random walks
flow operations: maximum flow, minimum s-t cut
matching: minimum weight matching on arbitrary graphs (EE), minimum b-matching (EE)
travelling salesman problem: a TSP solver based on linear programming (EE)
dismantling: collective influencer heuristic
drawing: different graph layouts
clique enumeration: maximal cliques
linear algebra / spectral graph theory: adjacency matrix, Laplacian matrix, non-backtracking matrix
community: modularity, community detection, core-periphery, clustering coefficients
distance within graphs: eccentricity, diameter, periphery, radius, center
distance between graphs: spectral_distance, edit_distance
Erdos is released under MIT License. Graphs stored in the datasets directory are released under GPLv3 License.
Huge credit goes to the contributors of LightGraphs.jl, from which this library is derived. Also thanks to Tiago de Paula Peixoto and his Python library graph-tool for inspiration and for the graphs in datasets.