Open BeCuriousCat opened 5 years ago
If you're using embedded it should be easy to upgrade to 3.5
You could also just call the procedure via db.execute() and pass in parameters, that would be easiest.
Usually you can cast GraphDatabaseService to GraphDatabaseAPI.
I think the clustering coefficient is computed by the procedure output.
Yes, i also think use db.execute() maybe simpler.
But i just use java embedding database, i don't download the server. From your document after download the jar, i have to change the conf file like
i don't have $NEO4J_HOME
dir. So i don't know how to change the conf.
When i just import the jar and use db.execute(), the following error are occurred.
org.neo4j.graphdb.QueryExecutionException: There is no procedure with the name `algo.triangleCount` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed.
Exception in thread "main" java.lang.NullPointerException
at Statistic.main(Statistic.java:207)
Here is my code:
public void calculateCC1(){
try{
// neo4j statement
//cyper statement
String query = "CALL algo.triangleCount('User', 'FRIEND',"
+"{concurrency:4, write:true, writeProperty:'triangles',clusteringCoefficientProperty:'coefficient'})"
+"YIELD loadMillis, computeMillis, writeMillis, nodeCount, triangleCount, averageClusteringCoefficient;";
Result result = graphDB.execute(query);
while ( result.hasNext() )
{
List<String> columns = result.columns();
System.out.println( columns );
}
System.out.println("successfully");
}catch(Exception e){
System.out.println("compute clustering coefficient fail!!!");
System.out.println(e);
}
}
If you're using embedded it should be easy to upgrade to 3.5
You could also just call the procedure via db.execute() and pass in parameters, that would be easiest.
Usually you can cast GraphDatabaseService to GraphDatabaseAPI.
I think the clustering coefficient is computed by the procedure output.
And i also confused about why the clustering coefficient is zero.. Thought it had computer the triangles.
If you're using embedded it should be easy to upgrade to 3.5 You could also just call the procedure via db.execute() and pass in parameters, that would be easiest. Usually you can cast GraphDatabaseService to GraphDatabaseAPI. I think the clustering coefficient is computed by the procedure output.
And i also confused about why the clustering coefficient is zero.. Thought it had computer the triangles.
i find the reason. Because i don't use algo.getCoefficients()
before i use algo.getAverageCoefficient
.
Thank you for ur answer!
Yes, i also think use db.execute() maybe simpler. But i just use java embedding database, i don't download the server. From your document after download the jar, i have to change the conf file like i don't have
$NEO4J_HOME
dir. So i don't know how to change the conf. When i just import the jar and use db.execute(), the following error are occurred.org.neo4j.graphdb.QueryExecutionException: There is no procedure with the name `algo.triangleCount` registered for this database instance. Please ensure you've spelled the procedure name correctly and that the procedure is properly deployed. Exception in thread "main" java.lang.NullPointerException at Statistic.main(Statistic.java:207)
Here is my code:
public void calculateCC1(){ try{ // neo4j statement //cyper statement String query = "CALL algo.triangleCount('User', 'FRIEND'," +"{concurrency:4, write:true, writeProperty:'triangles',clusteringCoefficientProperty:'coefficient'})" +"YIELD loadMillis, computeMillis, writeMillis, nodeCount, triangleCount, averageClusteringCoefficient;"; Result result = graphDB.execute(query); while ( result.hasNext() ) { List<String> columns = result.columns(); System.out.println( columns ); } System.out.println("successfully"); }catch(Exception e){ System.out.println("compute clustering coefficient fail!!!"); System.out.println(e); } }
How did you solve this error? ("there is no procedure...")
I had use Neo4j 3.2.2 in my application. But when i want to compute the clustering coefficient, I find i have to use the lasted version (3.5)。 After i see the
ClusteringCoefficientWikiTest.java
:But i don't have a
GraphDatabaseAPI db
, so i have to convertGraphDatabaseAPI db = (GraphDatabaseAPI) new GraphDatabaseFactory().newEmbeddedDatabase(database);
When i can't get the right clustering coefficient. The result is 0.0
In Debug model , i find it had computed the triangle count but can't give the right clustering coefficient