Skip to content

Instantly share code, notes, and snippets.

@LeifAndersen
Created June 19, 2015 18:18
Show Gist options
  • Save LeifAndersen/993fa5e320827f8c3654 to your computer and use it in GitHub Desktop.
Save LeifAndersen/993fa5e320827f8c3654 to your computer and use it in GitHub Desktop.
setClass("Node",
slots = list(data="character",
edges="list"))
setClass("Edge",
slots = list(weight="numeric",
left = "character",
right = "character"))
setClass("Graph",
slots = list(nodes = "list",
edges = "list"))
#setGeneric("==",
# function(e1,e2) standardGeneric("=="),
# useAsDefault = .Primitive("=="))
setMethod("==",
c(e1="Node",e2="Node"),
function(e1,e2) {
e1@data == e2@data
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment