Skip to content

Instantly share code, notes, and snippets.

@1tylermitchell
Last active August 29, 2015 14:15
Show Gist options
  • Save 1tylermitchell/5dac304c5cf9495d50f3 to your computer and use it in GitHub Desktop.
Save 1tylermitchell/5dac304c5cf9495d50f3 to your computer and use it in GitHub Desktop.
SPARQL query for Graph Density ratio
SELECT (?nrEdges/(?nrNodes *(?nrNodes - 1.0)) AS ?graphDensity)
FROM <graphName>
WHERE {
{ SELECT (COUNT (*) AS ?nrEdges) (COUNT (DISTINCT ?person) AS ?nrNodes)
WHERE { ?person <knows> ?anotherPerson . }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment