neo4j

Retrieve All Nodes That Can Be Reached By A Specific Node In A Directed Graph

怎甘沉沦 提交于 2019-12-11 15:17:20
问题 Given a graph in Neo4j that is directed (but possible to have cycles), how can I retrieve all nodes that are reachable from a specific node with Cypher? (Also: how long can I expect a query like this to take if my graph has 2 million nodes, and by extension 48 million nodes? A rough gauge will do eg. less than a minute, few minutes, an hour) 回答1: Cypher's uniqueness behavior is that relationships must be unique per path (each relationship can only be traversed once per path), but this isn't

Allow parameters for depth in Cypher query

☆樱花仙子☆ 提交于 2019-12-11 15:17:18
问题 I'm using Neo4j Bolt Driver 1.7 for Python to extract paths from a specific database, here's a sample of code that causes the problem. from neo4j import GraphDatabase uri = "bolt://0.0.0.0:7878" driver = GraphDatabase.driver(uri, auth=("neo4j", "neo4j")) db = driver.session() query = ''' MATCH tree = (n:Class)-[r:SUBCLASSOF*{depth}]->(parent) # <---- ERROR here WHERE n.obo_id = {go} RETURN [n in nodes(tree) | n.obo_id] as GOID ''' results = [] goid = "GO:0051838" for record in db.run(query,

Add dynamically created attributes in ressource

时光总嘲笑我的痴心妄想 提交于 2019-12-11 15:14:45
问题 I'm working on a project in Laravel where for persistance i'm using a nosql graph based database called neo4j .The thing is that,for a given model,for some reasons the app admin can create new fields in the UI and give the names and validation rules.That means a part from attributes defined in $fillable attributes,new fields are added dynamically.And to manage that,i've created a flexible validation rule for the given model to updated dynamically validation rules by considering new fields,and

Find all relationship disjoint longest paths in cypher/traversal API ordered by size

跟風遠走 提交于 2019-12-11 15:04:27
问题 I have an algorithm that I want to implement that finds the longest path/s in a graph. Then finds the next longest path/s that do not have any relationships in common with the previous path/s and so forth until the entire graph is represented as disjoint paths. They are disjoint with respect to the relationships they contain but will have overlapping nodes where they connect. I want each of these relationship disjoint paths ordered from largest to smallest. I was wondering if anybody could

Service unavailable error using neo4j driver for python

元气小坏坏 提交于 2019-12-11 15:04:03
问题 I am new to neo4j and trying to execute the demo project(Movie search) provided in neo4j website. While doing so I am getting an error to instantiate neo4j server from python. Alternatively, I am able to up and run neo4j server externally and use it. Please find the python code snippet and error details - import os from json import dumps from flask import Flask, g, Response, request from neo4j.v1 import GraphDatabase, basic_auth app = Flask(__name__, static_url_path='/static/') password = os

Neo4J common neighbors of a set nodes in a path

帅比萌擦擦* 提交于 2019-12-11 14:54:17
问题 My network consists of nodes and the relationship is a numeric number. Think of it as a set of cities, and the relationship is the whether there is a road and if so how far is it. I have path from my neo4j query, wonder how I can find the neighbor of this path given the following condition. These neighbors should be neighbor to more than one node in the path. In the following picture, I have tried to illustrate what I mean. My path looks like the blue star below. I would like to find the

Always loading certain child object in neo4j

好久不见. 提交于 2019-12-11 14:53:15
问题 class Node { Long id; String name; @Relationship(type="NodeToCategory") Address address; List<NodeB> nodeBList; } //node B CLass class NodeB { Long id; String someOther; @Relationship(type="NodeToCategory") Address address; List<NodeC> nodeCList; } class Address { Long id; String name; } When I run a query with depth 2 on the Node it returns nodeBList but it does not return addresses of NodeB. I want to make sure whenever there is an address object it will always return address no matter the

Neo4j: Return only the first common node in the graph discarding common children

帅比萌擦擦* 提交于 2019-12-11 14:51:55
问题 Starting with nodes in blue I want to compare each to the other in blue looking for their first common child nodes.(in green) My current query below is returning the first common node to all starting values and also all the common child nodes. (in red: left-hand graph) How can I filter the results so only the first common nodes (in green) are returned discarding the white and red nodes. I am starting with 2 - 10 values and currently can have over 100 result rows when only a couple of their

Resource specification not allowed error

喜欢而已 提交于 2019-12-11 14:48:38
问题 I'm getting the following error when running this java code in eclipse. Exception in thread "main" java.lang.Error: Unresolved compilation problems: Resource specification not allowed here for source level below 1.7 The type Transaction is not visible tx cannot be resolved at neo4jTesting.EmbeddedNeo4j.createDb(EmbeddedNeo4j.java:52) at neo4jTesting.EmbeddedNeo4j.main(EmbeddedNeo4j.java:38) Here is the code import java.io.File; import java.io.IOException; import org.neo4j.graphdb.Direction;

neo4j cypher: stacking nodes from sequential query results

旧街凉风 提交于 2019-12-11 14:38:17
问题 Considering the existence of three types of nodes in a db, connected by the schema (a:a)-[ra:madeWithB {ra.qty}]->(b:b)-[rb:madeWithC {rb.qty}]->(c:c) with the user being able to have connection with each one of these types. (user)-[:has {qty}]->(a:a) (user)-[:has {qty}]->(b:b) (user)-[:has {qty}]->(c:c) What would be the best way to query the database to return a list of all the nodes the user :has, considering that when he :has an (a) then in the result the associated (b) and (c) should