I never got a response from pcalg's maintainer, so I thought I'd publisher a patch here that allows you to specify optional node-labels; when no labels are specified, `plot' falls back on the default behaviour of labelling nodes sequentially. -------------- next part -------------- diff -Naur pcalg-orig/R/pcalg.R pcalg/R/pcalg.R --- pcalg-orig/R/pcalg.R 2007-03-22 03:20:49.000000000 -0700 +++ pcalg/R/pcalg.R 2007-11-26 00:07:24.000000000 -0800 @@ -292,14 +292,25 @@ }) setMethod("plot", signature(x = "pcAlgo"), - function(x, y, main = NULL, zvalue.lwd = FALSE, lwd.max = 7, ...) + function(x, y, main = NULL, zvalue.lwd = FALSE, lwd.max = 7, + labels = NULL, ...) { if(is.null(main)) main <- deparse(x at call) + attrs <- list() + nodeAttrs <- list() + if (!is.null(labels)) { + attrs$node <- list(shape = "ellipse", fixedsize = FALSE) + names(labels) <- nodes(x at graph) + nodeAttrs$label <- labels + } if (zvalue.lwd & numEdges(x at graph)!=0) { lwd.Matrix <- x at zMin lwd.Matrix <- ceiling(lwd.max*lwd.Matrix/max(lwd.Matrix)) - z <- agopen(x at graph,name="lwdGraph") + z <- agopen(x at graph, + name="lwdGraph", + nodeAttrs = nodeAttrs, + attrs = attrs) eLength <- length(z at AgEdge) for (i in 1:eLength) { x <- as.numeric(z at AgEdge[[i]]@head) @@ -308,7 +319,8 @@ } plot(z, main = main, ...) } else { - plot(x at graph, main = main, ...) + plot(x at graph, nodeAttrs = nodeAttrs, main = main, + attrs = attrs, ...) } })