GithubHelp home page GithubHelp logo

lightgraphs.jl's Introduction

LightGraphs

Build Status Coverage Status LightGraphs LightGraphs Documentation Status Join the chat at https://gitter.im/JuliaGraphs/LightGraphs.jl

An optimized graphs package.

Simple graphs (not multi- or hypergraphs) are represented in a memory- and time-efficient manner with adjacency lists and edge sets. Both directed and undirected graphs are supported via separate types, and conversion is available from directed to undirected.

The project goal is to mirror the functionality of robust network and graph analysis libraries such as NetworkX while being simpler to use and more efficient than existing Julian graph libraries such as Graphs.jl. It is an explicit design decision that any data not required for graph manipulation (attributes and other information, for example) is expected to be stored outside of the graph structure itself. Such data lends itself to storage in more traditional and better-optimized mechanisms.

Core Concepts

A graph G is described by a set of vertices V and edges E: G = {V, E}. V is an integer range 1:n; E is stored as a set of Edge types containing (src::Int, dst::Int) values. Edge relationships are stored as forward and backward incidence vectors, indexed by vertex.

Edges must be unique; an attempt to add an edge that already exists in a graph will result in an error.

Edge distances for most traversals may be passed in as a sparse or dense matrix of Float64 values, indexed by [src,dst] vertices. That is, distmx[2,4] = 2.5 assigns the distance 2.5 to the (directed) edge connecting vertex 2 and vertex 4. Note that for undirected graphs, distmx[4,2] should also be set.

Edge distances for undefined edges are ignored, and edge distances cannot be zero: any unassigned values (for sparse matrices) or zero values (for sparse or dense matrices) in the edge distance matrix are assumed to be the default distance of 1.0.

Basic Usage

(all examples apply equally to DiGraph unless otherwise noted):

# create an empty undirected graph
g = Graph()

# create a 10-node undirected graph with no edges
g = Graph(10)

# create a 10-node undirected graph with 30 randomly-selected edges
g = Graph(10,30)

# add an edge between vertices 4 and 5
add_edge!(g, 4, 5)

# remove an edge between vertices 9 and 10
rem_edge!(g, 9, 10)

# get the neighbors of vertex 4
neighbors(g, 4)

# show distances between vertex 4 and all other vertices
dijkstra_shortest_paths(g, 4).dists  

# as above, but with non-default edge distances
distmx = zeros(10,10)
distmx[4,5] = 2.5
distmx[5,4] = 2.5
dijkstra_shortest_paths(g, 4, distmx=distmx).dists

# graph I/O
g = readgraph("mygraph.jgz")
write(g,"mygraph.jgz")

Current functionality

  • core functions

    • degree (in/out/histogram)
    • neighbors (in/out/all/common)
  • distance

    • eccentricity
    • diameter
    • periphery
    • radius
    • center
  • connectivity

    • strongly- and weakly-connected components
    • bipartite checks
    • condensation
    • attracting components
  • operators

    • complement
    • reverse, reverse!
    • union
    • intersect
    • difference
    • symmetric difference
    • blkdiag
    • induced subgraphs
  • shortest path

    • Dijkstra / Dijkstra with predecessors
    • Bellman-Ford
    • Floyd-Warshall
    • A*
  • small graph generators

  • random graph generators

    • Erdős–Rényi
    • Watts-Strogatz
  • centrality

    • betweenness
    • closeness
    • degree
    • pagerank
  • linear algebra

  • persistence

    • proprietary compressed format
    • GraphML format

###Documentation Full documentation available at ReadTheDocs.

lightgraphs.jl's People

Contributors

sbromberger avatar jpfairbanks avatar zaccranko avatar marcliberatore avatar iainnz avatar rlouf avatar jiahao avatar yuyichao avatar

Watchers

James Cloos avatar Andy Hayden avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.