Use neo4j with R

雨燕双飞 提交于 2019-11-28 20:32:19

问题


Is there a R library that supports neo4j? I would like to construct a R graph (e.g. igraph) from neo4j or - vice versa - store a R graph in neo4j.

More precisely, I am looking for something similar to bulbflow for Python.


Update

There is a new neo4j driver for R that looks promising: http://nicolewhite.github.io/RNeo4j/. I changed the correct answer.


回答1:


Consider the RNeo4j driver. The function shown above is incomplete: it cannot return single column data and there is no NULL handling.

https://github.com/nicolewhite/RNeo4j




回答2:


This link might be helpful. I'm going to connect ne04j with R in the following days and will try first with the provided link. Hope it helps.

I tried it out and it works well. Here is the function that works: First, install and load packages and then execute function:

install.packages('RCurl')
install.packages('RJSONIO')

library('bitops')
library('RCurl')
library('RJSONIO')

query <- function(querystring) {
  h = basicTextGatherer()
  curlPerform(url="localhost:7474/db/data/ext/CypherPlugin/graphdb/execute_query",
    postfields=paste('query',curlEscape(querystring), sep='='),
    writefunction = h$update,
    verbose = FALSE
  )           
  result <- fromJSON(h$value())
  #print(result)
  data <- data.frame(t(sapply(result$data, unlist)))
  print(data)
  names(data) <- result$columns

}

and this is an example of calling function:

q <-"start a = node(50) match a-->b RETURN b"
 data <- query(q)



回答3:


I tried to use the R script (thanks a lot for providing it) and it seems to me that you can directly use : /db/data/cypher instead of db/data/ext/CypherPlugin/graphdb/execute_query (with neo4j 2.0).




回答4:


Not sure if it fits your requirements but have a look at Gephi. http://gephi.org/.



来源:https://stackoverflow.com/questions/11188918/use-neo4j-with-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!