GithubHelp home page GithubHelp logo

dotrado / neo4j-graph-algorithms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neo4j-contrib/neo4j-graph-algorithms

0.0 1.0 0.0 2.8 MB

Efficient Graph Algorithms for Neo4j

Home Page: http://neo4j-contrib.github.io/neo4j-graph-algorithms

License: GNU General Public License v3.0

Java 100.00%

neo4j-graph-algorithms's Introduction

Efficient Graph Algorithms for Neo4j (pre-Alpha / WIP)

Build Status

This project aims to develop efficient, well tested graph algorithm implementations for Neo4j 3.1 and 3.2.

You can find the documentation (WIP) here http://neo4j-contrib.github.io/neo4j-graph-algorithms

The goal is to provide parallel versions of common graph algorithms for Neo4j exposed as Cypher user defined procedures:

Centralities:

  • Page Rank

  • Betweenness Centrality

  • Closeness Centrality

Graph Partitioning:

  • Label Propagation

  • (Weakly) Connected Components

  • Strongly Connected Components

Path Finding:

  • Minimum Weight Spanning Tree

  • All Pairs- and Single Source - Shortest Path

These procedures work on a subgraphm optionally filtered by label and relationship-type. Future versions will also provide filtering and projection using Cypher queries.

We’d love your feedback, so please try out these algorithms and let us know how well they work for your use-case. Also please note things that you miss from installation instructions, readme, etc.

Please raise GitHub issues for anything you encounter or join the neo4j-users Slack group and ask in the #neo4j-graph-algorithm channel.

Installation

Just copy the graph-algorithms-algo-*.jar from the matching release into your $NEO4J_HOME/plugins directory and restart Neo4j.

Then running call dbms.procedures(); should also list the algorithm procedures.

CALL dbms.procedures() YIELD name, description, signature
WHERE name STARTS WITH "algo."
RETURN name, description, signature
ORDER BY name
Warning

For safety reasons, in Neo4j 3.2.x you will need to add/enable this line in your $NEO4J_HOME/conf/neo4j.conf:

dbms.security.procedures.unrestricted=algo.*

Introduction

Graph theory is the study of graphs, which are mathematical structures used to model pairwise relations between nodes. A graph is made up of nodes (vertices) which are connected by relationships (edges). A graph may be undirected, meaning that there is no distinction between the two nodes associated with each relationship, or its relationships may be directed from one node to another. Relationships are what graph is all about: two nodes are joined by a relationship when they are related in a specified way.

We are tied to our friends. Cities are connected by roads and airline routes. Flora and fauna are bound together in a food web. Countries are involved in trading relationships. The World Wide Web is a virtual network of information.

  • Note that Neo4j can only save directed relationships, but we can treat them as though they are undirected when we are doing the analysis

Usage

These algorithms are exposed as Neo4j procedures. You can call them directly from Cypher in your Neo4j Browser, from cypher-shell or your client code.

For most algorithms there are two procedures, one that writes results back to the graph as node-properties and another (named algo.<name>.stream) that returns a stream of data, e.g. node-ids and computed values.

The general call syntax is:

CALL algo.<name>([label],[relType],{config})

For example for page rank on dbpedia:

CALL algo.pageRank('Page','Link',{iterations:5, dampingFactor:0.85, write: true, writeProperty:'pagerank'});
// YIELD nodes, iterations, loadMillis, computeMillis, writeMillis, dampingFactor, write, writeProperty

CALL algo.pageRank.stream('Page','Link',{iterations:5, dampingFactor:0.85})
YIELD node, score
RETURN node, score
ORDER BY score DESC LIMIT 10;

Cypher Loading

If label and relationship-type are not selective enough to describe your subgraph to run the algorithm on, you can use Cypher statements to load or project subsets of your graph. Then use a node-statement instead of the label parameter and a relationship-statement instead of the relationship-type and use graph:'cypher' in the config.

You can also return a property value or weight (according to your config) in addition to the id’s from these statements.

CALL algo.pageRank(
'MATCH (p:Page) RETURN id(p) as id',
'MATCH (p1:Page)-[:Link]->(p2:Page) RETURN id(p1) as source, id(p2) as target',
{graph:'cypher', iterations:5, write: true});

Details on how to call the individual algorithms can be found in the project’s documentation

Building

Currently aiming at Neo4j 3.1 and 3.2 (in the 3.2 branch)

git clone https://github.com/neo4j-contrib/neo4j-graph-algorithms
cd neo4j-graph-algorithms
mvn clean install
cp algo/target/graph-algorithms-*.jar $NEO4J_HOME/plugins/
$NEO4J_HOME/bin/neo4j restart

neo4j-graph-algorithms's People

Contributors

knutwalker avatar mknblch avatar jexp avatar tomasonjo avatar fbiville avatar pstutz avatar ryguyrg avatar

Watchers

 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.