Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
Export the print functions
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolewhite committed Sep 4, 2015
1 parent 4748e9d commit 51782fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,16 @@ S3method(incomingRels,node)
S3method(newTransaction,graph)
S3method(nodes,path)
S3method(outgoingRels,node)
S3method(print,graph)
S3method(print,node)
S3method(print,path)
S3method(print,relationship)
S3method(rels,path)
S3method(shortestPath,node)
S3method(startGraph,default)
S3method(startNode,path)
S3method(startNode,relationship)
S3method(summary,graph)
S3method(updateProp,entity)
export(addConstraint)
export(addIndex)
Expand Down
5 changes: 5 additions & 0 deletions R/print.R
Original file line number Diff line number Diff line change
@@ -1,28 +1,33 @@
#' @export
print.graph = function(graph) {
cat("< Graph Object > \n")
invisible(lapply(names(graph), function(x) {print(graph[x])}))
}

#' @export
summary.graph = function(graph) {
query = "MATCH (a)-[r]->(b) RETURN DISTINCT head(labels(a)) AS This, type(r) as To, head(labels(b)) AS That"
df = suppressMessages(cypher(graph, query))
print(df)
}

#' @export
print.node = function(node) {
cat("< Node Object > \n")
if(suppressWarnings(any(!is.na(names(node))))) {
invisible(lapply(names(node), function(x) {print(node[x])}))
}
}

#' @export
print.relationship = function(rel) {
cat("< Relationship Object > \n")
if(suppressWarnings(any(!is.na(names(rel))))) {
invisible(lapply(names(rel), function(x) {print(rel[x])}))
}
}

#' @export
print.path = function(path) {
cat("< Path Object > \n")
if(suppressWarnings(any(!is.na(names(path))))) {
Expand Down

0 comments on commit 51782fd

Please sign in to comment.