[med-svn] [r-bioc-rbgl] 01/02: Imported Upstream version 1.48.1+dfsg

Christopher Hoskin christopher.hoskin at gmail.com
Thu Sep 1 08:07:16 UTC 2016


This is an automated email from the git hooks/post-receive script.

grinorcole-guest pushed a commit to branch master
in repository r-bioc-rbgl.

commit 04e758dd19a8d3ac64b9742ec2b2eb9e667ded0d
Author: Christopher Hoskin <christopher.hoskin at gmail.com>
Date:   Wed Aug 31 19:01:42 2016 +0100

    Imported Upstream version 1.48.1+dfsg
---
 BOOST_LICENSE_1_0.txt                       |   26 +
 DESCRIPTION                                 |   18 +
 NAMESPACE                                   |   82 ++
 NEWS                                        |   21 +
 PLAN_3.2003                                 |   40 +
 R/interfaces.R                              | 1456 +++++++++++++++++++++++++++
 R/kCores.R                                  |   49 +
 R/separates.R                               |   21 +
 R/zzz.R                                     |    2 +
 README.windows                              |   21 +
 RGNotes                                     |  121 +++
 build/vignette.rds                          |  Bin 0 -> 209 bytes
 configure.win                               |   11 +
 data/FileDep.rda                            |  Bin 0 -> 446 bytes
 inst/XML/FileDep.gxl                        |   38 +
 inst/XML/bfsex.gxl                          |   22 +
 inst/XML/biconn.gxl                         |   45 +
 inst/XML/conn.dot                           |   16 +
 inst/XML/conn.gxl                           |   51 +
 inst/XML/conn2.gxl                          |   53 +
 inst/XML/conn2iso.gxl                       |   53 +
 inst/XML/demo.gxl                           |   31 +
 inst/XML/dfsex.gxl                          |   18 +
 inst/XML/dijkex.gxl                         |   54 +
 inst/XML/dominator.gxl                      |   41 +
 inst/XML/hcs.gxl                            |   72 ++
 inst/XML/kmstEx.gxl                         |   49 +
 inst/XML/ospf.gxl                           |  298 ++++++
 inst/XML/simpleExample.gxl                  |   51 +
 inst/XML/snacliqueex.gxl                    |   33 +
 inst/XML/snacoreex.gxl                      |  108 ++
 inst/XML/snalambdaex.gxl                    |   65 ++
 inst/XML/telenet.gxl                        |  146 +++
 inst/XML/wag.gxl                            |   13 +
 inst/boostExamples/bfs-example.cpp          |   96 ++
 inst/boostExamples/connected_components.cpp |   78 ++
 inst/boostExamples/cycdet.cpp               |   83 ++
 inst/boostExamples/dfs-example.cpp          |  113 +++
 inst/boostExamples/file_dependencies.cpp    |  224 +++++
 inst/boostExamples/kruskal-example.cpp      |   86 ++
 inst/boostExamples/quick_tour.cpp           |  157 +++
 inst/demos/dem1.R                           |   17 +
 inst/demos/dem1.out                         |   45 +
 inst/demos/vcshort.R                        |  203 ++++
 inst/doc/RBGL.R                             |  515 ++++++++++
 inst/doc/RBGL.Rnw                           | 1197 ++++++++++++++++++++++
 inst/doc/RBGL.pdf                           |  Bin 0 -> 368053 bytes
 inst/dot/cc-internet.dot                    |   67 ++
 inst/dot/dfs-example.dot                    |   28 +
 inst/dot/edge-connectivity.dot              |   21 +
 inst/dot/joh.dot                            |   12 +
 inst/dot/joh.gxl                            |   60 ++
 inst/dot/lkedge.Rnw                         |   80 ++
 inst/dot/lkedge.pdf                         |  Bin 0 -> 67194 bytes
 inst/dot/ospf-graph.dot                     |   96 ++
 inst/dot/ospf.gxl                           |  298 ++++++
 inst/dot/scc.dot                            |   33 +
 inst/dot/telephone-network.dot              |   42 +
 inst/fdep.ps                                |  610 +++++++++++
 inst/unitTests/test_segfault.R              |   24 +
 man/FileDep.Rd                              |   33 +
 man/RBGL.overview.Rd                        |  121 +++
 man/astarSearch.Rd                          |   35 +
 man/bandwidth.Rd                            |   45 +
 man/bccluster.Rd                            |   58 ++
 man/bellman.ford.sp.Rd                      |   62 ++
 man/betweenness.Rd                          |   66 ++
 man/bfs.Rd                                  |   89 ++
 man/biConnComp.Rd                           |   62 ++
 man/boyerMyrvoldPlanarityTest.Rd            |   37 +
 man/chrobakPayneStraightLineDrawing.Rd      |   58 ++
 man/clusteringCoef.Rd                       |   56 ++
 man/clusteringCoefAppr.Rd                   |   53 +
 man/coloring.Rd                             |   50 +
 man/connectedComp.Rd                        |   53 +
 man/dag.sp.Rd                               |   62 ++
 man/defunct.Rd                              |   16 +
 man/dijkstra.sp.Rd                          |   65 ++
 man/dominatorTree.Rd                        |   47 +
 man/edgeConn.Rd                             |   54 +
 man/edmondsMaxCardinalityMatching.Rd        |   66 ++
 man/edmondsOptimumBranching.Rd              |   43 +
 man/extractPath.Rd                          |   40 +
 man/floyd.warshall.all.pairs.sp.Rd          |   49 +
 man/gprofile.Rd                             |   46 +
 man/graphGenerator.Rd                       |   45 +
 man/highlyConnSG.Rd                         |   64 ++
 man/incrConnComp.Rd                         |   69 ++
 man/is.triangulated.Rd                      |   58 ++
 man/isKuratowskiSubgraph.Rd                 |   59 ++
 man/isStraightLineDrawing.Rd                |   63 ++
 man/isomorphism.Rd                          |   55 +
 man/johnson.all.pairs.sp.Rd                 |   45 +
 man/kCliques.Rd                             |   55 +
 man/kCores.Rd                               |   58 ++
 man/lambdaSets.Rd                           |   55 +
 man/layout.Rd                               |  104 ++
 man/makeBiconnectedPlanar.Rd                |   56 ++
 man/makeConnected.Rd                        |   53 +
 man/makeMaximalPlanar.Rd                    |   53 +
 man/maxClique.Rd                            |   58 ++
 man/maxFlow.Rd                              |   69 ++
 man/maximumCycleRatio.Rd                    |   37 +
 man/minCut.Rd                               |   54 +
 man/minimumCycleRatio.Rd                    |   37 +
 man/mstree.kruskal.Rd                       |   60 ++
 man/mstree.prim.Rd                          |   50 +
 man/ordering.Rd                             |   89 ++
 man/planarCanonicalOrdering.Rd              |   56 ++
 man/planarFaceTraversal.Rd                  |   56 ++
 man/removeSelfLoops.Rd                      |   37 +
 man/separates.Rd                            |   50 +
 man/sloanStartEndVertices.Rd                |   37 +
 man/sp.between.Rd                           |   66 ++
 man/strongComp.Rd                           |   52 +
 man/transClosure.Rd                         |   45 +
 man/transitivity.Rd                         |   46 +
 man/tsort.Rd                                |   50 +
 man/wavefront.Rd                            |   58 ++
 src/Basic2DMatrix.hpp                       |   33 +
 src/RBGL.hpp                                |  142 +++
 src/SUSPENDED/layout.cpp                    |  238 +++++
 src/bbc.cpp                                 |  162 +++
 src/cliques.cpp                             |  304 ++++++
 src/clusteringCoef.cpp                      |  458 +++++++++
 src/dominatorTree.cpp                       |   66 ++
 src/edmonds_optimum_branching.cpp           |   73 ++
 src/edmonds_optimum_branching.hpp           |   96 ++
 src/edmonds_optimum_branching_impl.hpp      |  553 ++++++++++
 src/fruchterman_reingold.hpp                |  477 +++++++++
 src/hcs.cpp                                 |  484 +++++++++
 src/incrConnComp.cpp                        |  133 +++
 src/interfaces.cpp                          |  403 ++++++++
 src/minST.cpp                               |  114 +++
 src/mincut.cpp                              |  188 ++++
 src/mincut.hpp                              |  110 ++
 src/ordering.cpp                            |  282 ++++++
 src/planar.cpp                              |  724 +++++++++++++
 src/shortestPath.cpp                        |  200 ++++
 src/sna.cpp                                 |  255 +++++
 src/transitive_closure.cpp                  |   58 ++
 src/wavefront.cpp                           |  115 +++
 tests/runTests.R                            |    1 +
 vignettes/RBGL.Rnw                          | 1197 ++++++++++++++++++++++
 vignettes/filedep.eps                       |  544 ++++++++++
 vignettes/filedep.pdf                       |  Bin 0 -> 6827 bytes
 vignettes/leloc.R                           |   12 +
 147 files changed, 17997 insertions(+)

diff --git a/BOOST_LICENSE_1_0.txt b/BOOST_LICENSE_1_0.txt
new file mode 100644
index 0000000..b0fc047
--- /dev/null
+++ b/BOOST_LICENSE_1_0.txt
@@ -0,0 +1,26 @@
+The following text is the license for code included in inst/boostIncl
+
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+
diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..066b6f4
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,18 @@
+Package: RBGL
+Version: 1.48.1
+Title: An interface to the BOOST graph library
+Author: Vince Carey <stvjc at channing.harvard.edu>, Li Long
+        <li.long at isb-sib.ch>, R. Gentleman
+Maintainer: Bioconductor Package Maintainer
+ <maintainer at bioconductor.org>
+Depends: graph, methods
+Imports: methods
+Suggests: Rgraphviz, XML, RUnit, BiocGenerics
+Description: A fairly extensive and comprehensive interface to the
+        graph algorithms contained in the BOOST library.
+License: Artistic-2.0
+URL: http://www.bioconductor.org
+LazyLoad: yes
+biocViews: GraphAndNetwork, Network
+NeedsCompilation: yes
+Packaged: 2016-05-17 01:29:00 UTC; biocbuild
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..e48dd15
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,82 @@
+import("methods")
+import("graph")
+useDynLib(RBGL)
+
+export(
+ "articulationPoints",
+ "astarSearch",
+ "aver.wavefront",
+ "bandwidth",
+ "bellman.ford.sp",
+ "betweenness.centrality.clustering",
+ "biConnComp",
+ "boyerMyrvoldPlanarityTest",
+ "brandes.betweenness.centrality",
+ "chrobakPayneStraightLineDrawing",
+ "circle.layout",        
+ "circleLayout",        
+ "clusteringCoef",
+ "clusteringCoefAppr",
+ "connectedComp",        
+ "cuthill.mckee.ordering",
+ "dag.sp",
+ "dijkstra.sp",          
+ "dominatorTree",
+ "edgeConnectivity",     
+ "edmondsOptimumBranching",
+ "edmondsMaxCardinalityMatching",
+ "edmonds.karp.max.flow",
+ "extractPath",
+ "floyd.warshall.all.pairs.sp",
+ "fruchtermanReingoldForceDirectedLayout",
+ "gprofile",
+ "graphGenerator",
+ "gursoyAtunLayout",
+ "highlyConnSG",
+ "incremental.components",
+ "init.incremental.components",
+ "isKuratowskiSubgraph",
+ "isomorphism",
+ "isStraightLineDrawing",
+ "is.triangulated",
+ "ith.wavefront",
+ "johnson.all.pairs.sp", 
+ "kamada.kawai.spring.layout",
+ "kamadaKawaiSpringLayout",
+ "kCliques",
+ "kCores",
+ "kingOrdering",
+ "kolmogorov.max.flow",
+ "lambdaSets",
+ "lengauerTarjanDominatorTree",
+ "makeBiconnectedPlanar",
+ "makeConnected",
+ "makeMaximalPlanar",
+ "maxClique",
+ "maximumCycleRatio",
+ "maxWavefront",
+ "minCut",
+ "minDegreeOrdering",
+ "minimumCycleRatio",
+ "mstree.kruskal",       
+ "mstree.prim",       
+ "planarCanonicalOrdering",
+ "planarFaceTraversal",
+ "prim.minST",
+ "push.relabel.max.flow",
+ "randomGraphLayout",
+ "removeSelfLoops",
+ "rms.wavefront",
+ "same.component",
+ "separates",
+ "sequential.vertex.coloring", 
+ "sloan.ordering",
+ "sloanStartEndVertices",
+ "sp.between",
+ "sp.between.scalar",    
+ "strongComp",
+ "transitive.closure",
+ "transitivity",
+ "tsort")
+
+exportMethods("bfs", "dfs")
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..d88b488
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,21 @@
+14 June 2012
+============
+  boost header sources to 1.49, likely to drop layout support, mods to incremental.components
+
+Nov 30, 2005
+============
+New functions:
+  "is.triangulated",
+  "maxClique"
+
+Oct 15, 2005
+============
+New functions:
+ "articulationPoints",
+ "biConnComp",
+ "floyd.warshall.all.pairs.sp",
+ "fruchtermanReingoldForceDirectedLayout",
+ "highlyConnSG",
+ "randomGraphLayout",
+ "sequential.vertex.coloring", 
+
diff --git a/PLAN_3.2003 b/PLAN_3.2003
new file mode 100644
index 0000000..d44f1cc
--- /dev/null
+++ b/PLAN_3.2003
@@ -0,0 +1,40 @@
+May 2004: avoid edge weight manipulations in R?
+
+Plan of Oct 2003
+----------------
+1) rationalize graph and BGL approaches to undirected
+graphs -- graph wants reciprocated directed edges, BGL
+does not
+2) implement interfaces for
+  a) connected components
+  b) maximum flow/minimum disconnecting set
+
+Plan of July 2003
+1) state basic constraints:
+  a) all edge weights will be coerced to double on way in
+  b) separate C++ functions need to be written for directed
+     and undirected inputs
+2) simplify the C++ source of the R interfaces
+
+Plan of April 2003
+
+1) Use Boost 1.30.0 and make sure library
+still works for tsort and DAG cycle check
+*DONE 2 April
+
+2) convert tsort application to .Call interface
+
+3) get a better grip on how R data can be converted
+to Boost graphs, and bring in a graph with weights
+or distances
+
+4) deploy their MST method and compare to R mstree
+*KMST is in 2 april
+
+5) list the applications we want to have and try
+to get a generic interface
+
+6) consider building boost graphs in R by
+manipulating pointer structures.  perhaps this
+should be the highest priority!  boostGraph
+as a descendant of graph
diff --git a/R/interfaces.R b/R/interfaces.R
new file mode 100644
index 0000000..37fc0ae
--- /dev/null
+++ b/R/interfaces.R
@@ -0,0 +1,1456 @@
+tsort <- function(x) 
+{
+    if ( !isDirected(x) ) stop("requires directed graph")
+    nv <- length(nodes(x))
+    em <- edgeMatrix(x)
+    ne <- ncol(em)
+    ans <- .Call("BGL_tsort_D", 
+	as.integer(nv), as.integer(ne), as.integer(em-1), 
+	PACKAGE="RBGL")
+    if ( any(ans != 0) ) ans <- nodes(x)[ans+1]
+    else ans <- character(0)
+    ans
+}
+
+mstree.kruskal <- function(x) 
+{
+    nv <- length(nodes(x))
+    em <- edgeMatrix(x, duplicates=TRUE) # conform with edgeWeights unlisted
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(x))
+    ans <- .Call("BGL_KMST_D",
+      		as.integer(nv), as.integer(ne),
+      		as.integer(em-1), as.double(eW),
+                PACKAGE="RBGL")
+
+    ans[[1]] <- apply(ans[[1]], 2, function(x, y) y[x+1], nodes(x))
+    rownames(ans[[1]]) <- c("from", "to")
+    rownames(ans[[2]]) <- c("weight")
+    names(ans) <- c("edgeList", "weights")
+    ans$nodes <- nodes(x)
+    ans
+
+}
+
+prim.minST <- function () 
+{
+    .Defunct("mstree.prim", "RBGL")
+}
+
+mstree.prim <- function ( g ) 
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g, duplicates=TRUE) # conform with edgeWeights unlisted
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+
+    ans <- .Call("BGL_PRIM_U", 
+		as.integer(nv), as.integer(ne), 
+                as.integer(em-1), as.double(eW), 
+		PACKAGE="RBGL")
+
+    ans[[1]] <- apply(ans[[1]], 2, function(x, y) y[x+1], nodes(g))
+    rownames(ans[[1]]) <- c("from", "to")
+    rownames(ans[[2]]) <- c("weight")
+    names(ans) <- c("edgeList", "weights")
+    ans$nodes <- nodes(g)
+    ans
+}
+
+  setGeneric("bfs", function( object, node, checkConn=TRUE) 
+             standardGeneric("bfs"))
+
+setMethod("bfs",c("graph", "missing", "missing"),
+  function( object, node, checkConn=TRUE)
+          bfs(object, nodes(object)[1], TRUE))
+
+setMethod("bfs",c("graph", "missing", "logical"),
+  function( object, node, checkConn=TRUE)
+          bfs(object, nodes(object)[1], checkConn))
+
+setMethod("bfs",c("graph", "character", "missing"),
+  function( object, node, checkConn=TRUE)
+          bfs(object, node, TRUE))
+
+setMethod("bfs",c("graph", "character", "logical"),
+  function( object, node, checkConn)
+          bfs(object, node, checkConn))
+
+setMethod("bfs",c("graph", "character", "logical"),
+    function (object, node = nodes(object)[1], checkConn = TRUE) 
+    {
+    nodvec <- nodes(object)
+    if (!checkConn) 
+	warning("API is changing: checkConn is disregarded, connectivity always checked.")
+    if (is.na(startind <- match(node, nodvec))) 
+        stop("starting node not found in nodes of graph")
+    if (length(ccc <- connectedComp(object)) > 1) 
+    {
+        warning("graph is not connected; returning bfs applied to each connected component")
+        alln <- lapply(ccc, function(x) nodes(subGraph(x, object)))
+        hasStart <- sapply(alln, function(x) node %in% x)
+        def <- lapply(ccc[-which(hasStart)], 
+		      function(x) bfs(subGraph(x, object)))
+	names(def) <- NULL
+        wsta <- bfs(subGraph(ccc[[which(hasStart)]], object), node)
+        return(c(list(wsta), def))
+    }
+    nv <- length(nodvec)
+    em <- edgeMatrix(object, duplicates = TRUE)
+    ne <- ncol(em)
+    ans <- .Call("BGL_bfs_D", 
+		as.integer(nv), as.integer(ne), as.integer(em - 1), 
+		as.integer(rep(1, ne)), as.integer(startind - 1), 
+		PACKAGE = "RBGL")
+    sapply((ans + 1), function(x, y) y[x], nodes(object))
+    })
+
+if (!isGeneric("dfs"))
+   setGeneric("dfs", function(object,node,checkConn=TRUE)
+              standardGeneric("dfs"))
+
+setMethod("dfs",c("graph", "missing", "missing"),
+          function( object, node, checkConn=TRUE)
+          dfs(object, nodes(object)[1], TRUE))
+
+setMethod("dfs",c("graph", "character", "missing"),
+          function( object, node, checkConn=TRUE)
+          dfs(object, node, TRUE))
+
+setMethod("dfs",c("graph", "character", "logical"),
+          function( object, node, checkConn=TRUE) {
+    	  if (!checkConn) 
+	     warning("API is changing: checkConn is disregarded, connectivity always checked.")
+          nodvec <- nodes(object)
+          if (is.na(startind <- match(node,nodvec)))
+          {
+              warning("starting node not found in nodes of graph,\nnodes element 1 used")
+              startind <- 1
+          }
+        if (length(ccc <- connectedComp(object)) > 1) 
+	{
+            warning("graph is not connected; returning dfs applied to each connected component")
+            def <- lapply(ccc, function(x) dfs(subGraph(x, object)))
+       	    names(def) <- NULL
+            return(def)
+        }
+          nv <- length(nodvec)
+          em <- edgeMatrix(object,duplicates=TRUE)
+          ne <- ncol(em)
+          if (startind != 1)  # here we rearrange the node references in edgematrix
+          {          # to reflect altered start index
+            tem <- em
+            em[tem == 1] <- startind
+            em[tem == startind] <- 1
+          }
+          ans <- .Call("BGL_dfs_D", 
+			as.integer(nv), as.integer(ne),
+               		as.integer(em-1), as.integer(rep(1,ne)),
+               		PACKAGE="RBGL")
+          fixup <- function(x) 
+	  { 
+             tm <- x;
+             x[tm==(1-1)] <- startind-1
+             x[tm==(startind-1)] <- (1-1)
+             x
+          }
+          ans <- lapply(ans, fixup)
+          names(ans) <- c("discovered", "finish")
+          lapply(ans, function(x, y) y[x+1], nodes(object))
+         })
+
+dijkstra.sp <- function(g,start=nodes(g)[1], eW=unlist(edgeWeights(g))) 
+{
+    if (!is.character(start)) stop("start must be character")
+    if (length(start) !=1 ) stop("start must have length 1")
+
+    II <- match(start, nodes(g), 0)
+
+    if ( II == 0 ) stop("start not found in nodes of g")
+
+    if ( isDirected(g) )
+            em <- edgeMatrix(g)
+    else
+            em <- edgeMatrix(g,TRUE)
+
+    if ( any(eW < 0, na.rm=TRUE) ) 
+      stop("'dijkstra.sp' requires that all edge weights are nonnegative")
+
+    nN <- nodes(g)
+    nv <- length(nN)
+    ne <- ncol(em)
+    ans <- .Call("BGL_dijkstra_shortest_paths_D", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em-1), as.double(eW), as.integer(II - 1), 
+		PACKAGE="RBGL")
+
+    names(ans) <- c("distances", "penult")
+    ans[["distances"]][ ans[["distances"]] == .Machine$double.xmax ] <- Inf
+    names(ans[["distances"]]) <- names(ans[["penult"]]) <- nN
+    ans$penult <- ans$penult + 1
+    ans[["start"]] <- II
+    names(ans[["start"]]) <- nN[II]
+    ans
+}
+
+connectedComp <- function (g)
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    x<-.Call("BGL_connected_components_U", 
+		as.integer(nv), as.integer(ne),
+        	as.integer(em-1), as.double(rep(1,ne)), 
+		PACKAGE="RBGL")
+    split(nodes(g),x+1)
+}
+
+strongComp <- function (g)
+{
+    if (!isDirected(g)) stop("only applicable to directed graphs")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    x <- .Call("BGL_strong_components_D", 
+		as.integer(nv), as.integer(ne),
+        	as.integer(em-1), as.double(rep(1,ne)), 
+		PACKAGE="RBGL")
+    split(nodes(g),x+1)
+}
+
+edgeConnectivity <- function (g)
+{
+    if (isDirected(g)) stop("only applicable to undirected graphs")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    ans <- .Call("BGL_edge_connectivity_U", 
+		as.integer(nv), as.integer(ne),
+                as.integer(em-1), as.double(rep(1.,ne)), 
+		PACKAGE="RBGL")
+    mes <- ans[[2]]
+    mes <- lapply(mes,function(x,y) y[x+1], nodes(g)) # +1 for zero-based BGL
+    list(connectivity=ans[[1]], minDisconSet=mes)
+}
+
+minCut <- function (g)
+{
+    if (isDirected(g)) stop("only applicable to undirected graphs")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+
+    ans <- .Call("BGL_min_cut_U", 
+		as.integer(nv), as.integer(ne),
+                as.integer(em-1), as.double(rep(1.,ne)), 
+		PACKAGE="RBGL")
+
+    s_names <- sapply(ans[[2]]+1, function(x) { nodes(g)[x] })
+    vs_names <- sapply(ans[[3]]+1, function(x) { nodes(g)[x] })
+
+    if ( length(s_names) > length(vs_names) )
+    {  temp <- s_names; s_names <- vs_names; vs_names <- temp }
+
+    list(mincut=ans[[1]], "S"=s_names, "V-S"=vs_names)
+}
+
+removeSelfLoops <- function(g)
+{
+    g1 <- g
+    for ( n in nodes(g) )
+    {
+        if ( n %in% adj(g, n)[[1]] ) g1 <- removeEdge(n, n, g1)
+    }
+    g1
+}
+
+highlyConnSG <- function (g, sat=3, ldv=c(3, 2, 1))
+{
+    lldv <- length(ldv)
+    x = ldv[1:lldv-1] - ldv[2:lldv]
+   
+    if ( length(ldv) <= 1 ||
+         length(ldv[ldv>0]) != length(ldv) || 
+         length(x[x>0]) != length(x) )
+       stop("ldv has to be decreasing sequence of positive integers")
+    
+    if ( sat <= 0 ) stop("sat has to be positive")
+
+    if (isDirected(g)) stop("only applicable to undirected graphs")
+
+    for ( n in nodes(g) )
+       if ( n %in% adj(g, n)[[1]] )
+          stop("graph contains self-circle(s), use 'removeSelfLoops' first.")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+
+    ans <- .Call("BGL_highly_conn_sg", 
+		as.integer(nv), as.integer(ne),
+                as.integer(em-1), as.double(rep(1.,ne)), 
+                as.integer(sat), as.integer(lldv), as.integer(ldv),
+                PACKAGE="RBGL")
+
+    ans_names <- lapply(ans, function(x) { nodes(g)[x] })
+    list(clusters=ans_names)
+}
+
+
+extractPath <- function(s, f, pens) {
+# use list of penultimates (from dijkstra.sp) to establish
+# linear path from node s to node f
+    path <- f
+    maxl <- length(pens)
+    i <- 0
+    while (path[1] != s) {
+        if (i > maxl)        # no path available
+        {
+            path <- "NA" 
+            break
+        }
+        path <- c(pens[f], path)
+        f <- pens[f]
+        i <- i+1
+    }
+    as.numeric(path)
+}
+
+sp.between.scalar <- function (g, start, finish)
+{
+    stop("sp.between.scalar is obsolete, use sp.between instead")
+}
+
+sp.between <- function (g, start, finish, detail=TRUE)
+{
+    if ( length(start) <= 0 || length(finish) <= 0 )
+       stop("missing starting or finishing nodes")
+
+    nG = nodes(g)
+
+    if ( !all(start %in% nG) )
+       stop("all starting nodes have to be in the graph")
+
+    if ( !all(finish %in% nG) )
+       stop("all finishing nodes have to be in the graph")
+
+    ##get the node index, given the name
+    nodeind <- function(n) match(n, nG)
+
+    tmp = cbind(start, finish)
+    fl = split(tmp[,2], tmp[,1])
+
+    ustart <- unique(start)
+    ans <- list()
+    ws <- list()
+    eW=edgeWeights(g)
+    eWW=unlist(eW)
+
+    if ( any(eWW < 0, na.rm=TRUE) ) 
+      stop("'sp.between' requires that all edge weights are nonnegative")
+
+    for (i in 1:length(ustart)) 
+    {
+        curdi <- dijkstra.sp(g, ustart[i], eWW)$penult
+        thiss <- ustart[i]
+        thisf <- fl[[thiss]]
+        for (j in 1:length(thisf) ) 
+        {
+             ans[[paste(thiss, thisf[j], sep = ":")]] <-
+                   nG[extractPath(nodeind(thiss), nodeind(thisf[j]), curdi)]
+        }
+    }
+
+    getw <- function(nl) 
+    {
+         res <- NA
+
+         # obtain weights in g for path of nodes in char vec nl
+         if ( length(nl) > 1 )
+         {
+            res <- rep(NA,length(nl)-1)   # only n-1 pairs
+	    wstr <- eW[nl]
+            for (i in 1:(length(nl)-1))
+               res[i]<-wstr[[i]][nl[i+1]] # use numerical names of weights
+	    names(res) <- paste(nl[-length(nl)], nl[-1],
+			        sep=ifelse(isDirected(g),"->","--"))
+         }
+         res
+    }
+    ws <- lapply(ans, function(x) getw(x))
+    lens <- lapply(ws, sum)
+    ans2 <- vector("list", length=length(ans))
+    names(ans2) = names(ans)
+    for (i in 1:length(ans))
+    {
+       if ( detail ) 
+        ans2[[i]] <- list(length=lens[[i]],
+                          path_detail=as.vector(ans[[i]]), 
+                          length_detail=list(ws[[i]]))
+       else
+        ans2[[i]] <- list(length=lens[[i]])
+    }
+    ans2
+}
+
+johnson.all.pairs.sp <- function (g) 
+{
+    nv <- length(nodes(g))
+    if (isDirected(g)) 
+        em <- edgeMatrix(g)
+    else em <- edgeMatrix(g, TRUE)
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+    ans <- .Call("BGL_johnson_all_pairs_shortest_paths_D", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em - 1), as.double(eW), 
+		PACKAGE="RBGL")
+    tmp <- matrix(ans, nrow = length(nodes(g)))
+    dimnames(tmp) <- list(nodes(g), nodes(g))
+    tmp[ tmp >= .Machine$double.xmax ] <- Inf
+    t(tmp)
+}
+
+floyd.warshall.all.pairs.sp <- function (g) 
+{
+    nv <- length(nodes(g))
+    if (isDirected(g)) 
+        em <- edgeMatrix(g)
+    else em <- edgeMatrix(g, TRUE)
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+    ans <- .Call("BGL_floyd_warshall_all_pairs_shortest_paths_D", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em - 1), as.double(eW), 
+		PACKAGE="RBGL")
+    tmp <- matrix(ans, nrow = length(nodes(g)))
+    dimnames(tmp) <- list(nodes(g), nodes(g))
+    tmp[ tmp >= .Machine$double.xmax ] <- Inf
+    t(tmp)
+}
+
+bellman.ford.sp <- function(g, start=nodes(g)[1])
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+
+    if ( is.character(start) ) s <- match(start, nodes(g), 0)
+    else s <- start 
+
+    if ( s <= 0 || s > nv ) stop("start not found in nodes of g")
+
+    ans <- .Call("BGL_bellman_ford_shortest_paths", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em - 1), as.double(eW), as.integer(s-1), 
+		PACKAGE="RBGL")
+
+    ans[[2]][ ans[[2]] >= .Machine$double.xmax ] <- Inf
+    ans[[3]] <- ans[[3]] + 1
+
+    names(ans[[2]]) <- names(ans[[3]]) <- nodes(g)
+
+    list("all edges minimized"=ans[[1]], "distance"=ans[[2]], 
+         "penult"=ans[[3]], "start"=nodes(g)[s])
+}
+
+dag.sp <- function(g, start=nodes(g)[1])
+{
+    if (!isDirected(g)) stop("only applicable to directed graphs")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+
+    if ( is.character(start) ) s <- match(start, nodes(g), 0)
+    else s <- start
+
+    if ( s <= 0 || s > nv ) stop("start not found in nodes of g")
+
+    ans <- .Call("BGL_dag_shortest_paths", 
+		as.integer(nv), as.integer(ne), 
+            	as.integer(em - 1), as.double(eW), as.integer(s-1), 
+		PACKAGE="RBGL")
+    
+    ans[[1]][ ans[[1]] >= .Machine$double.xmax ] <- Inf
+    ans[[2]] <- ans[[2]] + 1
+
+    names(ans[[1]]) <- names(ans[[2]]) <- nodes(g)
+
+    list("distance"=ans[[1]], "penult"=ans[[2]], "start"=nodes(g)[s])
+}
+
+transitive.closure <- function (g) 
+{
+    nv <- length(nodes(g))
+    if (isDirected(g)) 
+        em <- edgeMatrix(g)
+    else em <- edgeMatrix(g, TRUE)
+    ne <- ncol(em)
+    ans <- .Call("BGL_transitive_closure_D", 
+		as.integer(nv), as.integer(ne), as.integer(em - 1), 
+		PACKAGE="RBGL")
+    
+    v_names <- sapply(ans[[1]]+1, function(x) { nodes(g)[x] })
+    nv <- length(v_names)
+
+    ans[[2]] <- ans[[2]] + 1
+    ne <- ncol(ans[[2]])
+
+    edL <- vector("list", length=nv)
+    names(edL) <- v_names
+    for(i in 1:nv) edL[[i]] <- list(edges=ans[[2]][2,][which(ans[[2]][1,]==i)])
+
+    g <- new("graphNEL", nodes=v_names, edgeL=edL, edgemode=edgemode(g))
+
+    g
+
+}
+
+max.flow.internal <- function (g, source, sink, method="Edmonds.Karp")
+{
+    if (!isDirected(g)) stop("only applicable to directed graphs")
+
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    eW <- unlist(edgeWeights(g))
+
+    if ( is.character(source) ) s <- match(source, nodes(g), 0)
+    else s <- source
+    if ( is.character(sink) ) t <- match(sink, nodes(g), 0)
+    else t <- sink
+
+    if ( s <= 0 || s > nv || t <= 0 || t > nv )
+       stop("both source and sink need to be nodes in the graph")
+
+    # nodes are numbered from 1 in R graph, but from 0 in BGL graph
+    if ( method == "Push.Relabel" )
+         ans <- .Call("BGL_push_relabel_max_flow", 
+                 as.integer(nv), as.integer(ne), 
+                 as.integer(em-1), as.double(eW), 
+                 as.integer(s-1), as.integer(t-1), 
+                 PACKAGE="RBGL")
+    else  if ( method == "Edmonds.Karp" ) 
+         ans <- .Call("BGL_edmonds_karp_max_flow", 
+                 as.integer(nv), as.integer(ne), 
+                 as.integer(em-1), as.double(eW), 
+                 as.integer(s-1), as.integer(t-1), 
+                 PACKAGE="RBGL")
+    else if ( method == "Kolmogorov")
+         ans <- .Call("BGL_kolmogorov_max_flow", 
+                 as.integer(nv), as.integer(ne), 
+                 as.integer(em-1), as.double(eW), 
+                 as.integer(s-1), as.integer(t-1), 
+                 PACKAGE="RBGL")
+    else 
+	stop("unknown method")
+
+    rownames(ans[[2]]) <- c("from", "to")
+    rownames(ans[[3]]) <- c("flow")
+    f_names <- sapply(ans[[2]][1,]+1, function(x) { nodes(g)[x] })
+    t_names <- sapply(ans[[2]][2,]+1, function(x) { nodes(g)[x] })
+    ans[[2]][1,] <- f_names
+    ans[[2]][2,] <- t_names
+
+    list("maxflow"=ans[[1]], "edges"=ans[[2]], "flows"=ans[[3]])
+}
+
+edmonds.karp.max.flow <- function (g, source, sink)
+{
+    max.flow.internal(g, source, sink, "Edmonds.Karp")
+}
+
+push.relabel.max.flow <- function (g, source, sink)
+{
+    max.flow.internal(g, source, sink, "Push.Relabel")
+}
+
+kolmogorov.max.flow <- function(g, source, sink)
+{
+    max.flow.internal(g, source, sink, "Kolmogorov")
+}
+
+edmondsMaxCardinalityMatching <- function(g)
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+
+    ans <- .Call("edmondsMaxCardinalityMatching", 
+                as.integer(nv), as.integer(ne), as.integer(em-1),
+                PACKAGE="RBGL")
+
+    ans[[1]] <- as.logical(ans[[1]])
+    ans[[2]] <- apply(ans[[2]], 2, function(x) { nodes(g)[x+1] } )
+    rownames(ans[[2]]) <- c("vertex", "matched vertex")
+    names(ans) <- c("Is max matching: ", "Matching: ")
+
+    ans
+}
+
+isomorphism <- function(g1, g2)
+{
+   nv1 <- length(nodes(g1))
+   em1 <- edgeMatrix(g1)
+   ne1 <- ncol(em1)
+
+   nv2 <- length(nodes(g2))
+   em2 <- edgeMatrix(g2)
+   ne2 <- ncol(em2)
+
+   ans <- .Call("BGL_isomorphism", 
+	        as.integer(nv1), as.integer(ne1), as.integer(em1-1), 
+                as.integer(nv2), as.integer(ne2), as.integer(em2-1), 
+                PACKAGE="RBGL")
+
+   list("isomorphism"=ans[[1]])
+}
+
+cuthill.mckee.ordering <- function(g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_cuthill_mckee_ordering", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   r_names <- sapply(ans[[1]]+1, function(x) { nodes(g)[x] })
+
+   list("reverse cuthill.mckee.ordering"=r_names,
+ 	"original bandwidth"=ans[[2]], "new bandwidth"=ans[[3]])
+}
+
+sequential.vertex.coloring <- function(g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_sequential_vertex_coloring", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1),
+                PACKAGE="RBGL")
+
+   names(ans[[2]]) = nodes(g)
+   list("no. of colors needed"=ans[[1]], "colors of nodes"=ans[[2]])
+}
+
+minDegreeOrdering <- function(g, delta=0)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_min_degree_ordering", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), as.integer(delta),
+                PACKAGE="RBGL")
+
+    ip_names <- sapply(ans[[1]]+1, function(x) { nodes(g)[x] })
+    p_names <- sapply(ans[[2]]+1, function(x) { nodes(g)[x] })
+
+   list("inverse_permutation"=ip_names, "permutation"=p_names)
+}
+
+sloan.ordering <- function(g, w1=1, w2=2)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_sloan_ordering", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), w1, w2,
+                PACKAGE="RBGL")
+
+   s_names <- sapply(ans[[1]]+1, function(x) { nodes(g)[x] })
+
+   list("sloan.ordering"=s_names, "bandwidth"=ans[[2]], 
+	"profile"=ans[[3]], "maxWavefront"=ans[[4]], 
+	"aver.wavefront"=ans[[5]], "rms.wavefront"=ans[[6]])
+}
+
+bandwidth <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_bandwidth", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("bandwidth"=ans[[1]])
+}
+
+gprofile <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_profile", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("profile"=ans[[1]])
+}
+
+ith.wavefront <- function (g, start=nodes(g)[1])
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+    if ( is.character(start) ) s <- match(start, nodes(g), 0)
+    else s <- start
+
+    if ( s <= 0 || s > nv )
+       stop("starting node needs to be from the graph")
+
+   ans <- .Call("BGL_ith_wavefront", 
+	        as.integer(nv), as.integer(ne), 
+		as.integer(em-1), as.integer(s-1),
+                PACKAGE="RBGL")
+
+   list("ith.wavefront"=ans[[1]])
+}
+
+maxWavefront <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_max_wavefront", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("maxWavefront"=ans[[1]])
+}
+
+aver.wavefront <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_aver_wavefront", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("aver.wavefront"=ans[[1]])
+}
+
+rms.wavefront <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_rms_wavefront", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("rms.wavefront"=ans[[1]])
+}
+
+init.incremental.components <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_init_incremental_components", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   ans[-1] <- lapply(nodes(g), function(x)x) # ans[-1], function(x, y) y[x+1], nodes(g))
+   names(ans[[1]]) = "no. of initial components"
+   ans
+}
+
+incremental.components <- function (g)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_incremental_components", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   ans[-1] <- lapply(ans[-1], function(x, y) y[x+1], nodes(g))
+   names(ans[[1]]) = "no. of connected components"
+   ans
+}
+
+same.component <- function (g, node1, node2)
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+    if ( is.character(node1) ) v1 <- match(node1, nodes(g), 0)
+    else v1 <- node1
+
+    if ( is.character(node2) ) v2 <- match(node2, nodes(g), 0)
+    else v2 <- node2
+
+    if ( v1 <= 0 || v1 > nv || v2 <= 0 || v2 > nv )
+       stop("nodes need to be from the graph")
+
+   ans <- .Call("BGL_same_component", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+	        as.integer(v1-1), as.integer(v2-1),
+                PACKAGE="RBGL")
+
+   ans
+}
+
+circle.layout <- function ( g, radius=1 )
+{
+   warning("API is changed: use circleLayout instead.")
+   circleLayout(g, radius)
+}
+
+circleLayout <- function ( g, radius=1 )
+{
+   if (isDirected(g)) stop("only applicable to undirected graphs")
+
+   if ( radius < 0 ) stop("requires: radius > 0 ")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_circle_layout", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.double(radius),
+                PACKAGE="RBGL")
+
+   rownames(ans) <- c("x", "y")
+   colnames(ans) <- nodes(g)
+   ans
+}
+
+kamada.kawai.spring.layout <- function ( g, edge_or_side=1, es_length=1 )
+{
+   warning("API is changed: use kamadaKawaiSpringLayout instead.")
+   kamadaKawaiSpringLayout(g, edge_or_side, es_length)
+}
+
+kamadaKawaiSpringLayout <- function ( g, edge_or_side=1, es_length=1 )
+{
+   if (isDirected(g)) stop("only applicable to undirected graphs")
+
+   if ( edge_or_side <= 0 ) stop("requires: es_length > 0")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   ans <- .Call("BGL_kamada_kawai_spring_layout", 
+	       as.integer(nv), as.integer(ne), 
+	       as.integer(em-1), as.double(eW),
+	       as.logical(edge_or_side), as.double(es_length),
+               PACKAGE="RBGL")
+
+   rownames(ans) <- c("x", "y")
+   colnames(ans) <- nodes(g)
+   ans
+}
+
+brandes.betweenness.centrality <- function ( g )
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   if ( any(eW <= 0, na.rm=TRUE) ) 
+      stop("'brandes.betweenness.centrality' requires that all edge weights are positive")
+
+   ans <- .Call("BGL_brandes_betweenness_centrality", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.double(eW),
+                PACKAGE="RBGL")
+
+   colnames(ans[[1]]) <- nodes(g)
+   colnames(ans[[3]]) <- nodes(g)
+
+   rownames(ans[[2]]) <- c("centrality")
+   rownames(ans[[5]]) <- c("from", "to")
+   ans[[5]] <- apply(ans[[5]], 2, function(x, y) y[x+1], nodes(g))
+
+   list("betweenness.centrality.vertices"=ans[[1]],
+        "edges"=ans[[5]],
+        "betweenness.centrality.edges"=ans[[2]],
+        "relative.betweenness.centrality.vertices"=ans[[3]],
+        "dominance"=ans[[4]])
+}
+
+betweenness.centrality.clustering <- function(g, threshold=-1, normalize=T )
+{
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   ans <- .Call("BGL_betweenness_centrality_clustering", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.double(eW), as.double(threshold), as.logical(normalize),
+                PACKAGE="RBGL")
+
+   if ( ans[[1]] > 0 )
+   {
+      ans[[2]] <- apply(ans[[2]], 2, function(x, y) y[x+1], nodes(g))
+      rownames(ans[[2]]) <- c("from", "to")
+      rownames(ans[[3]]) <- c("centrality")
+   }
+   list("no.of.edges" = ans[[1]], 
+        "edges"=ans[[2]],
+        "edge.betweenness.centrality"=ans[[3]])
+}
+
+biConnComp <- function(g)
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    ans <-.Call("BGL_biconnected_components_U", 
+		as.integer(nv), as.integer(ne),
+        	as.integer(em-1), as.double(rep(1,ne)), 
+		PACKAGE="RBGL")
+
+    ans[[2]] <- apply(ans[[2]], 2, function(x, y) y[x+1], nodes(g))
+    ans[[3]] <- ans[[3]] + 1    # comp no. starts from 1
+
+    r <- vector("list", ans[[1]])
+    for ( i in 1:ans[[1]])
+        r[[i]] <- unique(as.vector(ans[[2]][,which(ans[[3]]==i)]))
+
+    r
+}
+
+articulationPoints <- function(g)
+{
+    nv <- length(nodes(g))
+    em <- edgeMatrix(g)
+    ne <- ncol(em)
+    ans <-.Call("BGL_articulation_points_U", 
+		as.integer(nv), as.integer(ne),
+        	as.integer(em-1), as.double(rep(1,ne)), 
+		PACKAGE="RBGL")
+
+    ans <- sapply(ans+1, function(x) { nodes(g)[x] })
+    ans
+}
+
+kingOrdering <- function(g)
+{
+   list("kingOrdering is not implemented yet")
+}
+
+randomGraphLayout<- function(g, minX=0, maxX=1, minY=0, maxY=1)
+{
+   if (isDirected(g)) stop("only applicable to undirected graphs")
+
+   if ( minX >= maxX || minY >= maxY )
+      stop("requires: minX < maxX and minY < maxY ")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_random_layout", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.double(minX), as.double(maxX),
+		as.double(minY), as.double(maxY),
+                PACKAGE="RBGL")
+
+   rownames(ans) <- c("x", "y")
+   colnames(ans) <- nodes(g)
+   ans
+}
+
+fruchtermanReingoldForceDirectedLayout<- function(g, width=1, height=1)
+{
+   if (isDirected(g)) stop("only applicable to undirected graphs")
+
+   if ( length(connComp(g)) > 1 ) 
+      warning("This implementation doesn't handle disconnected graphs well.")
+
+   if ( width <= 0 || height <= 0 )
+      stop("requires: width > 0 and height > 0 ")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_FRFD_layout", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.double(width), as.double(height),
+                PACKAGE="RBGL")
+
+   rownames(ans) <- c("x", "y")
+   colnames(ans) <- nodes(g)
+   ans
+}
+
+gursoyAtunLayout <- function(g)
+{
+   list("gursoyAtunLayout is not implemented yet")
+}
+
+astarSearch <- function(g)
+{
+   list("astarSearch is not implemented yet")
+}
+
+is.triangulated <- function(g)
+{
+   if( isDirected(g) ) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("isTriangulated", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   if(ans[1] == 0 ) FALSE else TRUE
+}
+
+maxClique <- function (g, nodes=NULL, edgeMat=NULL) {
+#
+# new version allows omission of g and direct hand-in of nodes and edgeMat
+#
+    if (!missing(g) && isDirected(g))
+        stop("only appropriate for undirected graphs")
+    if (!(missing(g)) & (!is.null(nodes) | !is.null(edgeMat)))
+        stop("if g is supplied, must not supply nodes or edgeMat")
+    if (is.null(nodes)) gn = g at nodes else gn = nodes
+    if (is.null(edgeMat)) em <- edgeMatrix(g) else em = edgeMat
+    nv <- length(gn)
+    ne <- ncol(em)
+    ans <- .Call("maxClique", as.integer(nv), as.integer(ne),
+        as.integer(em - 1), PACKAGE = "RBGL")
+    ans_names <- lapply(ans, function(x) {
+        gn[x]
+    })
+    list(maxCliques = ans_names)
+}
+
+
+.maxClique <- function(g)
+{
+# old version, requires internal computation of nodes and edgeMatrix
+   if (isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("maxClique", 
+	        as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   ans_names <- lapply(ans, function(x) { nodes(g)[x] })
+   list("maxCliques"=ans_names)
+}
+
+kCliques <- function(g)
+{
+   if( isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   ans <- .Call("kCliques", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em-1), as.double(eW), 
+                PACKAGE="RBGL")
+
+   if ( length(ans) > 0 )
+   {
+      gn1 <- function(x) { nodes(g)[x+1] }
+      gn2 <- function(x) { lapply(x, gn1) }
+      ans_names <- lapply(ans, gn2)
+      names(ans_names) <- paste(1:length(ans_names), "-cliques", sep="")
+   }
+   else
+      ans_names <- ans
+
+   ans_names
+}
+
+lambdaSets <- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   ans <- .Call("lambdaSets", 
+		as.integer(nv), as.integer(ne), 
+		as.integer(em-1), as.double(eW), 
+                PACKAGE="RBGL")
+
+   makelist <- function(y)
+   {
+      z <- table(y) > 1
+      z <- names(z[z])
+      ans <- vector("list", length=length(z))
+      for ( i in 1:length(z) )
+          ans[i] <- list(names(y[y==z[i]]))
+      list(ans)
+   }
+
+   colnames(ans[[2]]) <- nodes(g)
+   t <- vector("list", length=nrow(ans[[2]]))
+   names(t) <- paste("lambda-", 0:(nrow(ans[[2]])-1), " sets", sep="")
+   for ( i in 1:nrow(ans[[2]]) )
+       t[i] <- makelist(ans[[2]][i,])
+
+   list("max edge connectivity" = ans[[1]], t)
+}
+
+clusteringCoef <- function(g, Weighted=FALSE, vW=degree(g))
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   if ( nv != length(vW) )
+      stop("length(vW) is not equal to number of nodes in the graph")
+
+   ans <- .Call("clusteringCoef", 
+		as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.integer(Weighted), as.double(vW), 
+                PACKAGE="RBGL")
+
+   list("clustering coefficient" = ans)
+}
+
+transitivity <- function(g) 
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("transitivity", 
+		as.integer(nv), as.integer(ne), as.integer(em-1), 
+                PACKAGE="RBGL")
+
+   list("transitivity" = ans)
+}
+
+clusteringCoefAppr <- function(g, k=length(nodes(g)), Weighted=FALSE, vW=degree(g))
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   if ( nv != length(vW) )
+      stop("length(vW) is not equal to number of nodes in the graph")
+
+   ans <- .Call("clusteringCoefAppr", as.integer(k), 
+		as.integer(nv), as.integer(ne), as.integer(em-1), 
+		as.integer(Weighted), as.double(vW), 
+                PACKAGE="RBGL")
+
+   list("clustering coefficient" = ans)
+}
+
+graphGenerator <- function(n, d, o)
+{
+   if ( n < 3 )
+      stop("Number of nodes (n) should be at least 3.")
+
+   if ( d < 2 )
+      stop("Degree of nodes (d) should be at least 2.")
+
+   if ( o <= 0 )
+      stop("Parameter (o) should be positive.")
+
+   ans <- .Call("graphGenerator", 
+		as.integer(n), as.integer(d), as.integer(o), 
+		PACKAGE="RBGL")
+
+   # convert node indexes: from 0-based in C to 1-based in R
+   ans[[3]] <- ans[[3]] + 1
+   rownames(ans[[3]]) <- c("from", "to")
+   
+   list("no. of nodes" = ans[[1]], "no.of edges" = ans[[2]], "edges"=ans[[3]])
+}
+
+dominatorTree <- function(g, start=nodes(g)[1])
+{
+   if ( length(start) !=1 ) stop("start must have length 1")
+
+   if ( is.character(start) ) s <- match(start, nodes(g), 0)
+   else s <- start 
+
+   nv <- length(nodes(g))
+   if ( s <= 0 || s > nv ) stop("start not found in nodes of g")
+
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("BGL_dominator_tree", 
+                as.integer(nv), as.integer(ne), as.integer(em-1),
+                as.integer(s-1),
+                PACKAGE="RBGL")
+
+   gn1 <- function(x) { nodes(g)[x+1] }
+   ans <- sapply(ans, gn1)
+   names(ans) <- nodes(g)
+   ans
+}
+
+sloanStartEndVertices<- function(g)
+{
+   list("this is a helper-function for sloan-ordering, used explicitly" )
+}
+
+lengauerTarjanDominatorTree<- function(g, start=nodes(g)[1])
+{
+   dominatorTree(g, start)
+}
+
+minimumCycleRatio<- function(g)
+{
+   list("This function is not implemented yet")
+}
+
+maximumCycleRatio<- function(g)
+{
+   list("This function is not implemented yet")
+}
+
+boyerMyrvoldPlanarityTest<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("boyerMyrvoldPlanarityTest",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   as.logical(ans)
+}
+
+planarFaceTraversal<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("planarFaceTraversal",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   ans <- sapply(ans, function(x, y) y[x+1], nodes(g))
+
+   ans
+}
+
+planarCanonicalOrdering<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("planarCanonicalOrdering",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   ans <- sapply(ans, function(x, y) y[x+1], nodes(g))
+   
+   ans
+}
+
+chrobakPayneStraightLineDrawing<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("chrobakPayneStraightLineDrawing",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   colnames(ans) <- nodes(g)
+   rownames(ans) <- c("x", "y")
+
+   ans
+}
+
+isStraightLineDrawing<- function(g, drawing)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+ 
+   if ( !is.matrix(drawing) || nrow(drawing) != 2 || ncol(drawing) != nv ) 
+      stop("needs 2xm matrix for coordinates")
+
+   ans <- .Call("isStraightLineDrawing",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), as.integer(drawing),
+		PACKAGE="RBGL")
+
+   as.logical(ans)
+}
+
+isKuratowskiSubgraph<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("isKuratowskiSubgraph",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   ans[[1]] <- as.logical(ans[[1]])
+   ans[[2]] <- as.logical(ans[[2]])
+   ans[[3]] <- apply(ans[[3]], 2, function(x) nodes(g)[x+1])
+   rownames(ans[[3]]) = c("from", "to")
+
+   list("Is planar: " = ans[[1]], 
+	"Is there a Kuratowski Subgraph: " = ans[[2]], 
+	"Edges of Kuratowski Subgraph: " = ans[[3]])
+}
+
+makeConnected<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("makeConnected",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   ans <- apply(ans, 2, function(x) { nodes(g)[x+1] } )
+
+   gn = new("graphNEL", nodes=nodes(g), edgemode="undirected")
+   gn <- addEdge(ans[1,], ans[2, ], gn)
+
+   gn 
+}
+
+makeBiconnectedPlanar<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("makeBiconnectedPlanar",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   names(ans) <- c("Is planar: ", "new graph")
+   ans[[1]] <- as.logical(ans[[1]])
+
+   if ( ans[[1]] )
+   {
+      ans[[2]] <- apply(ans[[2]], 2, function(x) { nodes(g)[x+1] } )
+
+      gn = new("graphNEL", nodes=nodes(g), edgemode="undirected")
+      gn <- addEdge(ans[[2]][1,], ans[[2]][2, ], gn)
+
+      ans[[2]] <- gn 
+   }
+
+   ans
+}
+
+makeMaximalPlanar<- function(g)
+{
+   if(isDirected(g)) stop("only appropriate for undirected graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+
+   ans <- .Call("makeMaximalPlanar",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), PACKAGE="RBGL")
+
+   names(ans) <- c("Is planar: ", "new graph")
+   ans[[1]] <- as.logical(ans[[1]])
+
+   if ( ans[[1]] )
+   {
+      ans[[2]] <- apply(ans[[2]], 2, function(x) { nodes(g)[x+1] } )
+
+      gn = new("graphNEL", nodes=nodes(g), edgemode="undirected")
+      gn <- addEdge(ans[[2]][1,], ans[[2]][2, ], gn)
+
+      ans[[2]] <- gn 
+   }
+
+   ans
+}
+
+
+edmondsOptimumBranching <- function(g)
+{
+   if(!isDirected(g)) stop("only appropriate for directed graphs")
+
+   nv <- length(nodes(g))
+   em <- edgeMatrix(g)
+   ne <- ncol(em)
+   eW <- unlist(edgeWeights(g))
+
+   ans <- .Call("edmondsOptimumBranching",
+                as.integer(nv), as.integer(ne),
+                as.integer(em-1), as.double(eW),
+		PACKAGE="RBGL")
+
+    ans[[1]] <- apply(ans[[1]], 2, function(x, y) y[x+1], nodes(g))
+    rownames(ans[[1]]) <- c("from", "to")
+    rownames(ans[[2]]) <- c("weight")
+    names(ans) <- c("edgeList", "weights")
+    ans$nodes <- unique(as.vector(ans[[1]]))
+    ans
+
+}
+
diff --git a/R/kCores.R b/R/kCores.R
new file mode 100644
index 0000000..83a4a1f
--- /dev/null
+++ b/R/kCores.R
@@ -0,0 +1,49 @@
+kCores <- function(g, EdgeType=c("in", "out"))
+{
+   nv <- numNodes(g)
+   core <- array(0, nv, dimnames=list(nodes(g)))
+
+   # compute the degrees of vertices
+   # order the set of vertices V in increasing order of their degrees
+   if ( edgemode(g) == "undirected")
+       deg <- sort(degree(g))
+   else   
+   {
+        indeg <- core
+        outdeg <- core
+	if ( any(EdgeType == "in") )  indeg <- degree(g)$inDegree
+	if ( any(EdgeType == "out") )  outdeg <- degree(g)$outDegree
+	deg <- indeg + outdeg
+        deg <- sort(deg)
+   }
+
+   # for each v in V in the order do
+   for ( i in 1:nv )
+   {
+       v = names(deg)[i]
+
+       core[v] = deg[v]
+
+       # for each u in neighbors(v) do
+       if ( edgemode(g) == "undirected") 
+           ul <- adj(g, v)[[1]]
+       else 
+       {
+           innb <- list()
+           outnb <- list()
+	   if ( any(EdgeType == "in") )  outnb <- edges(g, v)[[1]]
+	   if ( any(EdgeType == "out") )  innb <- inEdges(v, g)[[1]]
+           ul <- unlist(c(innb, outnb))
+       }
+
+       for ( u in ul )
+       {
+          if ( deg[u] > deg[v] ) 
+	  {
+	     deg[u] = deg[u] - 1
+   	     deg <- sort(deg)
+	  }
+       }
+   }
+   core
+}
diff --git a/R/separates.R b/R/separates.R
new file mode 100644
index 0000000..f9103bd
--- /dev/null
+++ b/R/separates.R
@@ -0,0 +1,21 @@
+separates = function(a, b, S1, g) {
+  if( !is.character(a) || !is.character(b) || !is.character(S1) )
+    stop("only vectors of node names allowed")
+  if( !is(g, "graph") )
+    stop("g must be a graph")
+
+  ng = nodes(g)
+  if( any(!(a %in% ng)) || any(!(b %in% ng)) || any(!(S1 %in% ng)) )
+     stop("arguments must be nodes in the graph")
+
+  ##sanity check
+  if ( any(a %in% S1) || any(b %in% S1) || any(a %in% b) )
+    stop("a, b and S1 must be disjoint")
+  
+  left = ng[ !(ng %in% S1)]
+  sg = subGraph(left, g)
+  ans = johnson.all.pairs.sp(sg)
+  sub1 = ans[a, b]
+  if( all(!is.finite(sub1)) ) TRUE else FALSE
+} 
+
diff --git a/R/zzz.R b/R/zzz.R
new file mode 100644
index 0000000..209b899
--- /dev/null
+++ b/R/zzz.R
@@ -0,0 +1,2 @@
+.onLoad <- function(libname, pkgname) require("methods")
+
diff --git a/README.windows b/README.windows
new file mode 100644
index 0000000..439bbfa
--- /dev/null
+++ b/README.windows
@@ -0,0 +1,21 @@
+July 9 2003 -- There are bad lines generated in the RBGL.def
+file which cause Rcmd INSTALL to die in ld while building
+RBGL.dll.  I find the following to succeed with either mingw
+or cygwin tools:
+   1) attempt a standard installation and wait for the error
+   2) edit RBGL/src/RBGL.def and remove all lines containing periods
+   3) in RBGL/src, MANUALLY perform the creation of the dll with a command like 
+g++ --shared -s -o RBGL.dll RBGL.def RBGL.a RBGL_res.o -LC:{$R_HOME}/src/gnuwin32 -lg2c -lR
+   [in the above you will probably need to expand {$R_HOME} manually]
+   4) attempt the standard installation of the modified source
+package.  The .dll will not be remade.  The boost header set will be 
+removed and untarred needlessly but this has no significance.  
+INSTALL will not try to recreate the dll, so the ld error will not recur.
+
+This package does not fully conform to the instructions in rw-FAQ
+for including C++ in packages for R for windows.  It does not
+seem feasible to extern "C" all function names in the entire
+boost header distribution.  Thus the offending .def file includes
+many symbols of no use to R.  Advice on how to rectify this or
+on how to automate the process of repairing the .def file should
+be posted to stvjc at channing.harvard.edu
diff --git a/RGNotes b/RGNotes
new file mode 100644
index 0000000..f691009
--- /dev/null
+++ b/RGNotes
@@ -0,0 +1,121 @@
+Date: Wed, 23 Jun 2004 16:46:01 -0400
+
+ I am trying to write up something on the RBGL package and 
+  the following seems a bit odd,
+  example(dfs)
+  dd2 = removeEdge("w", "t", dd)
+  dd3 = removeEdge("w", "x", dd2)
+  plot(dd3) #disconnected
+  bfs(dd3) #seems to make no sense
+  nodes(dd3)[bfs(dd3)]
+
+ Can you please put in some words to describe what you mean by
+ "both dfs and bfs can handle unconnected graphs", precisely what is
+  returned in this case? The example above suggests that this is an
+ untrue statement.
+ 
+>>> now checkConn is defaulting to TRUE.  the example
+>>> above throws an error.  we may want to force check for
+>>> all invocations
+>>> need to try some big examples
+
+ Can we ever expect to be able to supply the starting node for dfs? is
+ the
+ problem with the interface or with the underlying code?
+
+
+ thanks,
+
+  robert
+
+Date: Wed, 23 Jun 2004 16:46:01 -0400
+From: Robert Gentleman <rgentlem at jimmy.harvard.edu>
+To: Vincent Carey 525-2265 <stvjc at channing.harvard.edu>
+Subject: RBGL - part 2
+
+Hi Vince,
+    - some more info: it seems that the problem is with directed
+   versus undirected graphs
+
+   - if you look in your vignette you have bf defined and it
+    reads a graph from a file bfsex.gxl;
+
+   - I don't think you should do this, a graphNEL has reciprocated
+    edges if it is undirected; you can either use ugraph or you can
+    change your fromGXL function so that if it is deserializing to
+    a graphNEL object it honors the structure of the graphNEL objects
+
+>>> This has been done.  NELhandler now runs ugraph to
+>>> get reciprocation.  note that ugraph will do nothing
+>>> if it gets an undirected graph, so i have to flip the
+>>> edgemode temporarily to get ugraph to compute reciprocal 
+>>> edges
+
+   - and it seems that dfs and bfs on the undirected graph are
+   correct, but
+    not on the undirected version (either using your method of simply
+   changing
+   the edgemode, or using ugraph)
+
+   - I suspect something has changed in the graph representation that
+     has
+    never gotten propogated to RBGL, but I am not sure
+##some code that shows the problem from a different perspective
+set.seed(123)
+g1 <- randomEGraph(LETTERS[11:20], edges=15)
+
+g2 = addEdge(c("R","R"), c("N","K"),
+              g1, c(1,1) )
+ bfsg2 = bfs(g2)
+ dfsg2 = dfs(g2)
+ nodes(g2)[bfsg2]
+ nodes(g2)[dfsg2$discovered]
+
+(and looking at this last one, you should see Q, S, T in elements 5, 6
+and 7
+ but that is not possible, S has no edge to T and we have not yet
+ explored
+ all of S's children so we should not be going to T)
+
+
+   - we have a problem in that DFS does not do what dfs does; I am not
+     sure
+    what we should do to fix this; should we just live with it (both
+     do
+    what they are documented to do)
+
+   - is it your intention that
+      nodes(g)[bfs(g)]
+     should give the node labels in the order in which they are
+      visited
+    (and similarly for dfs)?. If so this is really what should be
+     documented and I, at least, would find it very helpful to have
+    an example (that did not rely on code, but rather explained in
+      words what
+    was supposed to happen, so that I could check the code against it)
+
+  - I looked at tsort and wondered why its return value is different
+
+m
+   that of dfs and bfs (it seems to be more similar to that of DFS,
+    but
+   I think we really want a single type of return value so that it
+   can be operated on).
+
+ - also could you add something that describes just what a topological
+   sort is to a naive users (perhaps explaining why a DAG is so
+   important).
+
+ - also I wonder if this is the right approach (where tsort does two
+   things)
+   couldn't we have a function called isDAG that does the testing and
+   then have tsort error out? that seems more reasonable
+
+
+  As you can see much work on the book is being done - but of course
+  this raises questions about the underlying code.
+
+ Hope all is well there,
+   Robert
+
+
diff --git a/build/vignette.rds b/build/vignette.rds
new file mode 100644
index 0000000..c242ffb
Binary files /dev/null and b/build/vignette.rds differ
diff --git a/configure.win b/configure.win
new file mode 100644
index 0000000..738338e
--- /dev/null
+++ b/configure.win
@@ -0,0 +1,11 @@
+#!/bin/sh
+BASEBOOSTNAME=rbgl_trimmed_boost_1_49_0
+BOOSTTGZNAME=${BASEBOOSTNAME}.tar.gz
+if test -d ./src/${BASEBOOSTNAME};
+	then 
+			echo 'found ' ${BASEBOOSTNAME} ' header sources and tar archive;\n using what is there.'
+	else
+		echo "untarring boost include tree...";
+#		cd src; gunzip -dc ${BOOSTTGZNAME} | tar xf -;
+		cd src; tar zxof ${BOOSTTGZNAME};
+fi;
diff --git a/data/FileDep.rda b/data/FileDep.rda
new file mode 100644
index 0000000..808280e
Binary files /dev/null and b/data/FileDep.rda differ
diff --git a/inst/XML/FileDep.gxl b/inst/XML/FileDep.gxl
new file mode 100644
index 0000000..94e1a02
--- /dev/null
+++ b/inst/XML/FileDep.gxl
@@ -0,0 +1,38 @@
+<gxl>
+ <graph id="filedep" edgemode="directed">
+  <node id="dax_h"/>
+  <node id="yow_h"/>
+  <node id="boz_h"/>
+  <node id="zow_h"/>
+  <node id="foo_cpp"/>
+  <node id="foo_o"/>
+  <node id="bar_cpp"/>
+  <node id="bar_o"/>
+  <node id="libfoobar_a"/>
+  <node id="zig_cpp"/>
+  <node id="zig_o"/>
+  <node id="zag_cpp"/>
+  <node id="zag_o"/>
+  <node id="libzigzag_a"/>
+  <node id="killerapp"/>
+  <edge id="e1" from="dax_h"  to="foo_cpp"/>
+  <edge id="e2" from="dax_h"  to="bar_cpp"/>
+  <edge id="e3" from="dax_h"  to="yow_h"/>
+  <edge id="e4" from="yow_h"  to="bar_cpp"/>
+  <edge id="e5" from="yow_h"  to="zag_cpp"/>
+  <edge id="e6" from="boz_h"  to="bar_cpp"/>
+  <edge id="e7" from="boz_h"  to="zig_cpp"/>
+  <edge id="e8" from="boz_h"  to="zag_cpp"/>
+  <edge id="e9" from="zow_h"  to="foo_cpp"/>
+  <edge id="e10" from="foo_cpp" to="foo_o"/>
+  <edge id="e11" from="foo_o"  to="libfoobar_a"/>
+  <edge id="e12" from="bar_cpp" to="bar_o"/>
+  <edge id="e13" from="bar_o"  to="libfoobar_a"/>
+  <edge id="e14" from="libfoobar_a" to="libzigzag_a"/>
+  <edge id="e15" from="zig_cpp" to="zig_o"/>
+  <edge id="e16" from="zig_o"  to="libzigzag_a"/>
+  <edge id="e17" from="zag_cpp"  to="zag_o"/>
+  <edge id="e18" from="zag_o" to="libzigzag_a"/>
+  <edge id="e19" from="libzigzag_a" to="killerapp"/>
+ </graph>
+</gxl>
diff --git a/inst/XML/bfsex.gxl b/inst/XML/bfsex.gxl
new file mode 100644
index 0000000..f17aa67
--- /dev/null
+++ b/inst/XML/bfsex.gxl
@@ -0,0 +1,22 @@
+<gxl>
+ <graph id="G" edgemode="directed">
+  <node id="r"/>
+  <node id="s"/>
+  <node id="t"/>
+  <node id="u"/>
+  <node id="v"/>
+  <node id="w"/>
+  <node id="x"/>
+  <node id="y"/>
+  <edge id="e1" from="r" to="s"/>
+  <edge id="e2" from="r" to="v"/>
+  <edge id="e3" from="s" to="w"/>
+  <edge id="e4" from="w" to="r"/>
+  <edge id="e5" from="w" to="t"/>
+  <edge id="e6" from="w" to="x"/>
+  <edge id="e7" from="x" to="t"/>
+  <edge id="e8" from="t" to="u"/>
+  <edge id="e9" from="x" to="y"/>
+  <edge id="e10" from="u" to="y"/>
+ </graph>
+</gxl>
diff --git a/inst/XML/biconn.gxl b/inst/XML/biconn.gxl
new file mode 100644
index 0000000..d0838b8
--- /dev/null
+++ b/inst/XML/biconn.gxl
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="undirected">
+		<node id="A">
+		</node>
+		<edge from="A" to="B" isdirected="false" id="A--B">
+		</edge>
+		<edge from="A" to="F" isdirected="false" id="A--F">
+		</edge>
+		<edge from="A" to="G" isdirected="false" id="A--G">
+		</edge>
+		<node id="B">
+		</node>
+                <edge from="B" to="C" isdirected="false" id="B--C">
+                </edge>
+                <edge from="B" to="D" isdirected="false" id="B--D">
+                </edge>
+                <edge from="B" to="E" isdirected="false" id="B--E">
+                </edge>
+		<node id="C">
+		</node>
+                <edge from="C" to="D" isdirected="false" id="C--D">
+                </edge>
+		<node id="D">
+		</node>
+		<node id="E">
+		</node>
+                <edge from="E" to="F" isdirected="false" id="E--F">
+                </edge>
+		<node id="F">
+		</node>
+		<node id="G">
+		</node>
+                <edge from="G" to="I" isdirected="false" id="G--I">
+                </edge>
+                <edge from="G" to="H" isdirected="false" id="G--H">
+                </edge>
+		<node id="H">
+		</node>
+		<node id="I">
+		</node>
+                <edge from="I" to="H" isdirected="false" id="I--H">
+                </edge>
+	</graph>
+</gxl>
diff --git a/inst/XML/conn.dot b/inst/XML/conn.dot
new file mode 100644
index 0000000..55f057c
--- /dev/null
+++ b/inst/XML/conn.dot
@@ -0,0 +1,16 @@
+graph GG {
+ A -- B
+ A -- C
+ A -- D
+ B -- C
+ B -- D
+ C -- D
+ D -- E
+ D -- H
+ E -- F
+ E -- G
+ E -- H
+ F -- G
+ F -- H
+ G -- H
+}
diff --git a/inst/XML/conn.gxl b/inst/XML/conn.gxl
new file mode 100644
index 0000000..700bb73
--- /dev/null
+++ b/inst/XML/conn.gxl
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="undirected">
+		<node id="A">
+		</node>
+		<edge from="A" to="B" isdirected="false" id="A##B">
+		</edge>
+		<edge from="A" to="C" isdirected="false" id="A##C">
+		</edge>
+		<edge from="A" to="D" isdirected="false" id="A##D">
+		</edge>
+		<node id="B">
+		</node>
+		<edge from="B" to="C" isdirected="false" id="B##C">
+		</edge>
+		<edge from="B" to="D" isdirected="false" id="B##D">
+		</edge>
+		<node id="C">
+		</node>
+		<edge from="C" to="D" isdirected="false" id="C##D">
+		</edge>
+		<node id="D">
+		</node>
+		<edge from="D" to="E" isdirected="false" id="D##E">
+		</edge>
+		<edge from="D" to="H" isdirected="false" id="D##H">
+		</edge>
+		<node id="E">
+		</node>
+		<edge from="E" to="F" isdirected="false" id="E##F">
+		</edge>
+		<edge from="E" to="G" isdirected="false" id="E##G">
+		</edge>
+		<edge from="E" to="H" isdirected="false" id="E##H">
+		</edge>
+		<node id="H">
+		</node>
+		<node id="F">
+		</node>
+		<edge from="F" to="G" isdirected="false" id="F##G">
+		</edge>
+		<edge from="F" to="H" isdirected="false" id="F##H">
+		</edge>
+		<node id="G">
+		</node>
+		<edge from="G" to="H" isdirected="false" id="G##H">
+		</edge>
+	</graph>
+</gxl>
+<!--
+-->
diff --git a/inst/XML/conn2.gxl b/inst/XML/conn2.gxl
new file mode 100644
index 0000000..56cdf4c
--- /dev/null
+++ b/inst/XML/conn2.gxl
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="directed">
+		<node id="A">
+		</node>
+		<edge from="A" to="B" isdirected="true" id="A--B">
+		</edge>
+		<edge from="A" to="C" isdirected="true" id="A--C">
+		</edge>
+		<edge from="A" to="D" isdirected="true" id="A--D">
+		</edge>
+		<node id="B">
+		</node>
+		<edge from="B" to="C" isdirected="true" id="B--C">
+		</edge>
+		<edge from="B" to="D" isdirected="true" id="B--D">
+		</edge>
+		<node id="C">
+		</node>
+		<edge from="C" to="D" isdirected="true" id="C--D">
+		</edge>
+		<edge from="C" to="E" isdirected="true" id="C--E">
+		</edge>
+		<edge from="C" to="G" isdirected="true" id="C--G">
+		</edge>
+		<node id="D">
+		</node>
+		<edge from="D" to="E" isdirected="true" id="D--E">
+		</edge>
+		<edge from="D" to="H" isdirected="true" id="D--H">
+		</edge>
+		<node id="E">
+		</node>
+		<edge from="E" to="F" isdirected="true" id="E--F">
+		</edge>
+		<edge from="E" to="G" isdirected="true" id="E--G">
+		</edge>
+		<edge from="E" to="H" isdirected="true" id="E--H">
+		</edge>
+		<node id="H">
+		</node>
+		<node id="F">
+		</node>
+		<edge from="F" to="G" isdirected="true" id="F--G">
+		</edge>
+		<edge from="F" to="H" isdirected="true" id="F--H">
+		</edge>
+		<node id="G">
+		</node>
+		<edge from="G" to="H" isdirected="true" id="G--H">
+		</edge>
+	</graph>
+</gxl>
diff --git a/inst/XML/conn2iso.gxl b/inst/XML/conn2iso.gxl
new file mode 100644
index 0000000..f4ede5f
--- /dev/null
+++ b/inst/XML/conn2iso.gxl
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="directed">
+		<node id="A1">
+		</node>
+		<edge from="A1" to="A2" isdirected="true" id="A1--A2">
+		</edge>
+		<edge from="A1" to="A3" isdirected="true" id="A1--A3">
+		</edge>
+		<edge from="A1" to="A4" isdirected="true" id="A1--A4">
+		</edge>
+		<node id="A2">
+		</node>
+		<edge from="A2" to="A3" isdirected="true" id="A2--A3">
+		</edge>
+		<edge from="A2" to="A4" isdirected="true" id="A2--A4">
+		</edge>
+		<node id="A3">
+		</node>
+		<edge from="A3" to="A4" isdirected="true" id="A3--A4">
+		</edge>
+		<edge from="A3" to="A5" isdirected="true" id="A3--A5">
+		</edge>
+		<edge from="A3" to="A8" isdirected="true" id="A3--A8">
+		</edge>
+		<node id="A4">
+		</node>
+		<edge from="A4" to="A5" isdirected="true" id="A4--A5">
+		</edge>
+		<edge from="A4" to="A6" isdirected="true" id="A4--A6">
+		</edge>
+		<node id="A5">
+		</node>
+		<edge from="A5" to="A7" isdirected="true" id="A5--A7">
+		</edge>
+		<edge from="A5" to="A8" isdirected="true" id="A5--A8">
+		</edge>
+		<edge from="A5" to="A6" isdirected="true" id="A5--A6">
+		</edge>
+		<node id="A6">
+		</node>
+		<node id="A7">
+		</node>
+		<edge from="A7" to="A8" isdirected="true" id="A7--A8">
+		</edge>
+		<edge from="A7" to="A6" isdirected="true" id="A7--A6">
+		</edge>
+		<node id="A8">
+		</node>
+		<edge from="A8" to="A6" isdirected="true" id="A8--A6">
+		</edge>
+	</graph>
+</gxl>
diff --git a/inst/XML/demo.gxl b/inst/XML/demo.gxl
new file mode 100644
index 0000000..1e8c3ea
--- /dev/null
+++ b/inst/XML/demo.gxl
@@ -0,0 +1,31 @@
+<gxl>
+	<graph id="G" edgemode="directed">
+		<node id="P" type="Proc">
+ 		<attr name="File" value="main.c"/>
+		</node>
+
+		<node id="Q" type="Proc">
+ 		<attr name="File" value="test.c"/>
+		</node>
+
+		<node id="V" type="Var">
+ 		<attr name="Line" value="225"/>
+		</node>
+
+		<node id="W" type="Var">
+ 		<attr name="Line" value="316"/>
+		</node>
+
+		<edge from="P" to="Q" type="Call">
+ 		<attr name="Line" value="42"/>
+		</edge>
+
+		<edge from="P" to="V" type="Ref">
+ 		<attr name="Line" value="127"/>
+		</edge>
+
+		<edge from="Q" to="W" type="Ref">
+ 		<attr name="Line" value="316"/>
+		</edge>
+	</graph>
+</gxl>
diff --git a/inst/XML/dfsex.gxl b/inst/XML/dfsex.gxl
new file mode 100644
index 0000000..9da6d92
--- /dev/null
+++ b/inst/XML/dfsex.gxl
@@ -0,0 +1,18 @@
+<gxl>
+ <graph id="G" edgemode="directed">
+  <node id="u"/>
+  <node id="v"/>
+  <node id="w"/>
+  <node id="x"/>
+  <node id="y"/>
+  <node id="z"/>
+  <edge id="e1" from="u" to="v"/>
+  <edge id="e2" from="u" to="x"/>
+  <edge id="e3" from="v" to="y"/>
+  <edge id="e4" from="w" to="y"/>
+  <edge id="e5" from="w" to="z"/>
+  <edge id="e6" from="x" to="v"/>
+  <edge id="e7" from="y" to="x"/>
+  <edge id="e8" from="z" to="z"/>
+ </graph>
+</gxl>
diff --git a/inst/XML/dijkex.gxl b/inst/XML/dijkex.gxl
new file mode 100644
index 0000000..2cf79c0
--- /dev/null
+++ b/inst/XML/dijkex.gxl
@@ -0,0 +1,54 @@
+<gxl>
+ <graph id="G" edgemode="directed">
+  <node id="A"/>
+  <node id="B"/>
+  <node id="C"/>
+  <node id="D"/>
+  <node id="E"/>
+  <edge id="e1" from="A" to="C">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e2" from="B" to="B">
+   <attr name="weight">
+    <int>2</int>
+   </attr>
+  </edge>
+  <edge id="e3" from="B" to="D">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e4" from="B" to="E">
+   <attr name="weight">
+    <int>2</int>
+   </attr>
+  </edge>
+  <edge id="e5" from="C" to="B">
+   <attr name="weight">
+    <int>7</int>
+   </attr>
+  </edge>
+  <edge id="e6" from="C" to="D">
+   <attr name="weight">
+    <int>3</int>
+   </attr>
+  </edge>
+  <edge id="e7" from="D" to="E">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e8" from="E" to="A">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e9" from="E" to="B">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+ </graph>
+</gxl>
diff --git a/inst/XML/dominator.gxl b/inst/XML/dominator.gxl
new file mode 100644
index 0000000..016d2ea
--- /dev/null
+++ b/inst/XML/dominator.gxl
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="directed">
+		<node id="0">
+		</node>
+		<node id="1">
+		</node>
+		<node id="2">
+		</node>
+		<node id="3">
+		</node>
+		<node id="4">
+		</node>
+		<node id="5">
+		</node>
+		<node id="6">
+		</node>
+		<node id="7">
+		</node>
+		<edge from="0" to="1" isdirected="true" >
+		</edge>
+		<edge from="1" to="2" isdirected="true" >
+		</edge>
+		<edge from="1" to="3" isdirected="true" >
+		</edge>
+		<edge from="2" to="7" isdirected="true" >
+		</edge>
+		<edge from="3" to="4" isdirected="true" >
+		</edge>
+		<edge from="4" to="5" isdirected="true" >
+		</edge>
+		<edge from="4" to="6" isdirected="true" >
+		</edge>
+		<edge from="5" to="7" isdirected="true" >
+		</edge>
+		<edge from="6" to="4" isdirected="true" >
+		</edge>
+	</graph>
+</gxl>
+<!--
+-->
diff --git a/inst/XML/hcs.gxl b/inst/XML/hcs.gxl
new file mode 100644
index 0000000..748cab6
--- /dev/null
+++ b/inst/XML/hcs.gxl
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="undirected">
+		<node id="A1">
+		</node>
+		<edge from="A1" to="A2" isdirected="false" id="A1--A2">
+		</edge>
+		<edge from="A1" to="A4" isdirected="false" id="A1--A4">
+		</edge>
+		<edge from="A1" to="A5" isdirected="false" id="A1--A5">
+		</edge>
+		<edge from="A1" to="Y" isdirected="false" id="A1--Y">
+		</edge>
+		<node id="A2">
+		</node>
+		<edge from="A2" to="A3" isdirected="false" id="A2--A3">
+		</edge>
+		<edge from="A2" to="A4" isdirected="false" id="A2--A4">
+		</edge>
+		<node id="A4">
+		</node>
+		<edge from="A4" to="A5" isdirected="false" id="A4--A5">
+		</edge>
+		<node id="A5">
+		</node>
+		<edge from="A5" to="B1" isdirected="false" id="A5--B1">
+		</edge>
+		<node id="A3">
+		</node>
+		<edge from="A3" to="A4" isdirected="false" id="A3--A4">
+		</edge>
+		<edge from="A3" to="A5" isdirected="false" id="A3--A5">
+		</edge>
+		<node id="B1">
+		</node>
+		<edge from="B1" to="B2" isdirected="false" id="B1--B2">
+		</edge>
+		<edge from="B1" to="B3" isdirected="false" id="B1--B3">
+		</edge>
+		<edge from="B1" to="B4" isdirected="false" id="B1--B4">
+		</edge>
+		<edge from="B1" to="Y" isdirected="false" id="B1--Y">
+		</edge>
+		<node id="B2">
+		</node>
+		<edge from="B2" to="B3" isdirected="false" id="B2--B3">
+		</edge>
+		<edge from="B2" to="B4" isdirected="false" id="B2--B4">
+		</edge>
+		<node id="B3">
+		</node>
+		<edge from="B3" to="B4" isdirected="false" id="B3--B4">
+		</edge>
+		<node id="B4">
+		</node>
+		<edge from="B4" to="Z" isdirected="false" id="B4--Z">
+		</edge>
+		<node id="X">
+		</node>
+		<edge from="X" to="Y" isdirected="false" id="X--Y">
+		</edge>
+		<edge from="X" to="Z" isdirected="false" id="X--Z">
+		</edge>
+		<node id="Y">
+		</node>
+		<edge from="Y" to="Z" isdirected="false" id="Y--Z">
+		</edge>
+		<node id="Z">
+		</node>
+	</graph>
+</gxl>
+
diff --git a/inst/XML/kmstEx.gxl b/inst/XML/kmstEx.gxl
new file mode 100644
index 0000000..99b8daf
--- /dev/null
+++ b/inst/XML/kmstEx.gxl
@@ -0,0 +1,49 @@
+<gxl>
+ <graph edgemode="directed" id="G">
+  <node id="A"/>
+  <node id="B"/>
+  <node id="C"/>
+  <node id="D"/>
+  <node id="E"/>
+  <edge id="e1" from="A" to="C">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e2" from="B" to="D">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e3" from="B" to="E">
+   <attr name="weight">
+    <int>2</int>
+   </attr>
+  </edge>
+  <edge id="e4" from="C" to="B">
+   <attr name="weight">
+    <int>7</int>
+   </attr>
+  </edge>
+  <edge id="e5" from="C" to="D">
+   <attr name="weight">
+    <int>3</int>
+   </attr>
+  </edge>
+  <edge id="e6" from="E" to="D">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e7" from="E" to="A">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+  <edge id="e8" from="E" to="B">
+   <attr name="weight">
+    <int>1</int>
+   </attr>
+  </edge>
+ </graph>
+</gxl>
diff --git a/inst/XML/ospf.gxl b/inst/XML/ospf.gxl
new file mode 100644
index 0000000..bde85a7
--- /dev/null
+++ b/inst/XML/ospf.gxl
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="G" edgeids="false" edgemode="directed">
+		<attr name="ratio" kind="graph">
+			<string>fill</string>
+		</attr>
+		<attr name="size" kind="graph">
+			<string>4,6</string>
+		</attr>
+		<attr name="style" kind="edge">
+			<string>bold</string>
+		</attr>
+		<node id="RT1">
+		</node>
+		<edge id="e100" from="RT1" to="N1" isdirected="true">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<edge id="e101" from="RT1" to="N3" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT2">
+		</node>
+		<edge id="e102" from="RT2" to="N2" isdirected="true">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<edge id="e103" from="RT2" to="N3" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT3">
+		</node>
+		<edge id="e104" from="RT3" to="RT6" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge id="e105" from="RT3" to="N3" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e106" from="RT3" to="N4" isdirected="true">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<node id="RT4">
+		</node>
+		<edge id="e107" from="RT4" to="N3" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e108" from="RT4" to="RT5" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<node id="RT5">
+		</node>
+		<edge id="e109" from="RT5" to="RT4" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge id="e201" from="RT5" to="RT6" isdirected="true">
+			<attr name="weight">
+				<int>7</int>
+			</attr>
+		</edge>
+		<edge id="e202" from="RT5" to="RT7" isdirected="true">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge id="e203" from="RT5" to="N12" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge id="e204" from="RT5" to="N13" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge id="e205" from="RT5" to="N14" isdirected="true">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<node id="RT6">
+		</node>
+		<edge id="e206" from="RT6" to="RT3" isdirected="true">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge id="e207" from="RT6" to="RT5" isdirected="true">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge id="e208" from="RT6" to="RT10" isdirected="true">
+			<attr name="weight">
+				<int>7</int>
+			</attr>
+		</edge>
+		<node id="RT7">
+		</node>
+		<edge id="e209" from="RT7" to="RT5" isdirected="true">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge id="e300" from="RT7" to="N6" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e301" from="RT7" to="N12" isdirected="true">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge id="e302" from="RT7" to="N15" isdirected="true">
+			<attr name="weight">
+				<int>9</int>
+			</attr>
+		</edge>
+		<node id="RT8">
+		</node>
+		<edge id="e303" from="RT8" to="N6" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e304" from="RT8" to="N7" isdirected="true">
+			<attr name="weight">
+				<int>4</int>
+			</attr>
+		</edge>
+		<node id="RT9">
+		</node>
+		<edge id="e305" from="RT9" to="N9" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e306" from="RT9" to="N11" isdirected="true">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<node id="RT10">
+		</node>
+		<edge id="e307" from="RT10" to="RT6" isdirected="true">
+			<attr name="weight">
+				<int>5</int>
+			</attr>
+		</edge>
+		<edge id="e308" from="RT10" to="N6" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e309" from="RT10" to="N8" isdirected="true">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<node id="RT11">
+		</node>
+		<edge id="e310" from="RT11" to="N8" isdirected="true">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge id="e311" from="RT11" to="N9" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT12">
+		</node>
+		<edge id="e312" from="RT12" to="N9" isdirected="true">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge id="e313" from="RT12" to="N10" isdirected="true">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge id="e314" from="RT12" to="H1" isdirected="true">
+			<attr name="weight">
+				<int>10</int>
+			</attr>
+		</edge>
+		<node id="N1">
+		</node>
+		<node id="N2">
+		</node>
+		<node id="N3">
+		</node>
+		<edge id="e320" from="N3" to="RT1" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e321" from="N3" to="RT2" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e322" from="N3" to="RT3" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e323" from="N3" to="RT4" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N4">
+		</node>
+		<node id="N6">
+		</node>
+		<edge id="e400" from="N6" to="RT7" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e401" from="N6" to="RT8" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e402" from="N6" to="RT10" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N7">
+		</node>
+		<node id="N8">
+		</node>
+		<edge id="e403" from="N8" to="RT10" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e404" from="N8" to="RT11" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N9">
+		</node>
+		<edge id="e405" from="N9" to="RT9" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e406" from="N9" to="RT11" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge id="e407" from="N9" to="RT12" isdirected="true">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N10">
+		</node>
+		<node id="N11">
+		</node>
+		<node id="N12">
+		</node>
+		<node id="N13">
+		</node>
+		<node id="N14">
+		</node>
+		<node id="N15">
+		</node>
+		<node id="H1">
+		</node>
+	</graph>
+</gxl>
diff --git a/inst/XML/simpleExample.gxl b/inst/XML/simpleExample.gxl
new file mode 100755
index 0000000..5e5567a
--- /dev/null
+++ b/inst/XML/simpleExample.gxl
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<!DOCTYPE gxl SYSTEM "http://www.gupro.de/GXL/gxl-1.0.1.dtd">
+<?xml-stylesheet type="text/xsl" href="../../highlightme.xsl"?>
+<!-- simple example 05.02.2002, from GXL site  -->
+<gxl xmlns:xlink="http://www.w3.org/1999/xlink">
+	<graph id="simpleExample" edgemode="directed">
+		<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#simpleExampleSchema"/>
+		<node id="p">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#Proc"/>
+			<attr name="file">
+				<string>main.c</string>
+			</attr>
+		</node>
+		<node id="q">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#Proc"/>
+			<attr name="file">
+				<string>test.c</string>
+			</attr>
+		</node>
+		<node id="v">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#Var"/>
+			<attr name="line">
+				<int>225</int>
+			</attr>
+		</node>
+		<node id="w">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#Var"/>
+			<attr name="line">
+				<int>316</int>
+			</attr>
+		</node>
+		<edge id="r1" from="p" to="v">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#ref"/>
+			<attr name="line">
+				<int>127</int>
+			</attr>
+		</edge>
+		<edge id="r2" from="q" to="w">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#ref"/>
+			<attr name="line">
+				<int>27</int>
+			</attr>
+		</edge>
+		<edge id="c" from="p" to="q">
+			<type xlink:href="../../schema/gxl/simpleExampleSchema.gxl#call"/>
+			<attr name="line">
+				<int>42</int>
+			</attr>
+		</edge>
+	</graph>
+</gxl>
diff --git a/inst/XML/snacliqueex.gxl b/inst/XML/snacliqueex.gxl
new file mode 100644
index 0000000..53dd87b
--- /dev/null
+++ b/inst/XML/snacliqueex.gxl
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="undirected">
+		<node id="1">
+		</node>
+		<edge from="1" to="2" isdirected="false" id="1##2">
+		</edge>
+		<edge from="1" to="3" isdirected="false" id="1##3">
+		</edge>
+		<node id="2">
+		</node>
+		<edge from="2" to="3" isdirected="false" id="2##3">
+		</edge>
+		<edge from="2" to="4" isdirected="false" id="2##4">
+		</edge>
+		<node id="3">
+		</node>
+		<edge from="3" to="5" isdirected="false" id="3##4">
+		</edge>
+		<node id="4">
+		</node>
+		<edge from="4" to="6" isdirected="false" id="4##5">
+		</edge>
+		<node id="5">
+		</node>
+		<edge from="5" to="6" isdirected="false" id="5##6">
+		</edge>
+		<node id="6">
+		</node>
+	</graph>
+</gxl>
+<!--
+-->
diff --git a/inst/XML/snacoreex.gxl b/inst/XML/snacoreex.gxl
new file mode 100644
index 0000000..d186952
--- /dev/null
+++ b/inst/XML/snacoreex.gxl
@@ -0,0 +1,108 @@
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgeids="true" edgemode="undirected">
+		<node id="A">
+		</node>
+		<edge from="A" to="C" isdirected="false" id="A##C">
+		</edge>
+		<node id="B">
+		</node>
+		<edge from="B" to="C" isdirected="false" id="B##C">
+		</edge>
+		<node id="C">
+		</node>
+		<edge from="C" to="E" isdirected="false" id="C##E">
+		</edge>
+		<edge from="C" to="F" isdirected="false" id="C##F">
+		</edge>
+		<node id="D">
+		</node>
+		<edge from="D" to="G" isdirected="false" id="D##G">
+		</edge>
+		<edge from="D" to="H" isdirected="false" id="D##H">
+		</edge>
+		<edge from="D" to="J" isdirected="false" id="D##J">
+		</edge>
+		<edge from="D" to="E" isdirected="false" id="D##E">
+		</edge>
+		<node id="E">
+		</node>
+		<edge from="E" to="F" isdirected="false" id="E##F">
+		</edge>
+		<node id="F">
+		</node>
+		<edge from="F" to="K" isdirected="false" id="F##K">
+		</edge>
+		<edge from="F" to="I" isdirected="false" id="F##I">
+		</edge>
+		<edge from="F" to="L" isdirected="false" id="F##L">
+		</edge>
+		<node id="G">
+		</node>
+		<edge from="G" to="H" isdirected="false" id="G##H">
+		</edge>
+		<edge from="G" to="J" isdirected="false" id="G##J">
+		</edge>
+		<node id="H">
+		</node>
+		<edge from="H" to="J" isdirected="false" id="H##J">
+		</edge>
+		<node id="I">
+		</node>
+		<edge from="I" to="K" isdirected="false" id="I##K">
+		</edge>
+		<edge from="I" to="L" isdirected="false" id="I##L">
+		</edge>
+		<node id="J">
+		</node>
+		<edge from="J" to="K" isdirected="false" id="J##K">
+		</edge>
+		<edge from="J" to="M" isdirected="false" id="J##M">
+		</edge>
+		<node id="K">
+		</node>
+		<edge from="K" to="M" isdirected="false" id="K##M">
+		</edge>
+		<edge from="K" to="N" isdirected="false" id="K##N">
+		</edge>
+		<edge from="K" to="L" isdirected="false" id="K##L">
+		</edge>
+		<node id="L">
+		</node>
+		<node id="M">
+		</node>
+		<edge from="M" to="N" isdirected="false" id="M##N">
+		</edge>
+		<edge from="M" to="O" isdirected="false" id="M##O">
+		</edge>
+		<node id="N">
+		</node>
+		<node id="O">
+		</node>
+		<node id="P">
+		</node>
+		<edge from="P" to="Q" isdirected="false" id="P##Q">
+		</edge>
+		<node id="Q">
+		</node>
+		<edge from="Q" to="R" isdirected="false" id="Q##R">
+		</edge>
+		<edge from="Q" to="S" isdirected="false" id="Q##S">
+		</edge>
+		<node id="R">
+		</node>
+		<edge from="R" to="T" isdirected="false" id="R##T">
+		</edge>
+		<node id="S">
+		</node>
+		<edge from="S" to="T" isdirected="false" id="S##T">
+		</edge>
+		<node id="T">
+		</node>
+		<node id="U">
+		</node>
+	</graph>
+</gxl>
+<!--
+-->
diff --git a/inst/XML/snalambdaex.gxl b/inst/XML/snalambdaex.gxl
new file mode 100644
index 0000000..4cfce73
--- /dev/null
+++ b/inst/XML/snalambdaex.gxl
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="GG" edgemode="undirected">
+		<node id="A1">
+		</node>
+		<node id="A2">
+		</node>
+		<node id="A3">
+		</node>
+		<node id="A4">
+		</node>
+		<node id="A5">
+		</node>
+		<node id="A6">
+		</node>
+		<node id="A7">
+		</node>
+		<node id="A8">
+		</node>
+		<node id="A9">
+		</node>
+		<node id="A10">
+		</node>
+		<node id="A11">
+		</node>
+		<node id="A12">
+		</node>
+		<edge from="A1" to="A2" >
+		</edge>
+		<edge from="A1" to="A3" >
+		</edge>
+		<edge from="A1" to="A4" >
+		</edge>
+		<edge from="A3" to="A2" >
+		</edge>
+		<edge from="A3" to="A4" >
+		</edge>
+		<edge from="A2" to="A5" >
+		</edge>
+		<edge from="A4" to="A7" >
+		</edge>
+		<edge from="A5" to="A6" >
+		</edge>
+		<edge from="A5" to="A8" >
+		</edge>
+		<edge from="A7" to="A6" >
+		</edge>
+		<edge from="A7" to="A8" >
+		</edge>
+		<edge from="A6" to="A8" >
+		</edge>
+		<edge from="A6" to="A9" >
+		</edge>
+		<edge from="A9" to="A10" >
+		</edge>
+		<edge from="A9" to="A11" >
+		</edge>
+		<edge from="A10" to="A12" >
+		</edge>
+		<edge from="A11" to="A12" >
+		</edge>
+	</graph>
+</gxl>
+<!--
+-->
diff --git a/inst/XML/telenet.gxl b/inst/XML/telenet.gxl
new file mode 100644
index 0000000..58447da
--- /dev/null
+++ b/inst/XML/telenet.gxl
@@ -0,0 +1,146 @@
+<?xml version="1.0"?>
+<gxl>
+  <graph id="graphNEL" edgemode="undirected">
+    <node id="Nobel"/>
+    <node id="McKellar"/>
+    <node id="Parry Sound"/>
+    <node id="Horseshoe Lake"/>
+    <node id="Rosseau"/>
+    <node id="Mactier"/>
+    <node id="Bent River"/>
+    <node id="Dunchurch"/>
+    <node id="Magnetawan"/>
+    <node id="Kearny"/>
+    <node id="Glen Orchard"/>
+    <node id="Sprucedale"/>
+    <node id="Novar"/>
+    <node id="Huntsville"/>
+    <node id="Bracebridge"/>
+    <edge id="e1" from="Nobel" to="McKellar">
+      <attr name="weight"><int>9</int></attr>
+    </edge>
+    <edge id="e2" from="Nobel" to="Parry Sound">
+      <attr name="weight"><int>3</int></attr>
+    </edge>
+    <edge id="e3" from="McKellar" to="Nobel">
+      <attr name="weight"><int>9</int></attr>
+    </edge>
+    <edge id="e4" from="McKellar" to="Dunchurch">
+      <attr name="weight"><int>11</int></attr>
+    </edge>
+    <edge id="e5" from="McKellar" to="Magnetawan">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e6" from="Parry Sound" to="Nobel">
+      <attr name="weight"><int>3</int></attr>
+    </edge>
+    <edge id="e7" from="Parry Sound" to="Horseshoe Lake">
+      <attr name="weight"><int>10</int></attr>
+    </edge>
+    <edge id="e8" from="Parry Sound" to="Dunchurch">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e9" from="Horseshoe Lake" to="Mactier">
+      <attr name="weight"><int>14</int></attr>
+    </edge>
+    <edge id="e10" from="Horseshoe Lake" to="Rosseau">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e11" from="Horseshoe Lake" to="Parry Sound">
+      <attr name="weight"><int>10</int></attr>
+    </edge>
+    <edge id="e12" from="Rosseau" to="Bent River">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e13" from="Rosseau" to="Horseshoe Lake">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e14" from="Mactier" to="Horseshoe Lake">
+      <attr name="weight"><int>14</int></attr>
+    </edge>
+    <edge id="e15" from="Mactier" to="Glen Orchard">
+      <attr name="weight"><int>9</int></attr>
+    </edge>
+    <edge id="e16" from="Bent River" to="Huntsville">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e17" from="Bent River" to="Rosseau">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e18" from="Dunchurch" to="Parry Sound">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e19" from="Dunchurch" to="McKellar">
+      <attr name="weight"><int>11</int></attr>
+    </edge>
+    <edge id="e20" from="Dunchurch" to="Magnetawan">
+      <attr name="weight"><int>12</int></attr>
+    </edge>
+    <edge id="e21" from="Magnetawan" to="Dunchurch">
+      <attr name="weight"><int>12</int></attr>
+    </edge>
+    <edge id="e22" from="Magnetawan" to="McKellar">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e23" from="Magnetawan" to="Kearny">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e24" from="Magnetawan" to="Sprucedale">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e25" from="Kearny" to="Magnetawan">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e26" from="Kearny" to="Sprucedale">
+      <attr name="weight"><int>13</int></attr>
+    </edge>
+    <edge id="e27" from="Kearny" to="Novar">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e28" from="Glen Orchard" to="Mactier">
+      <attr name="weight"><int>9</int></attr>
+    </edge>
+    <edge id="e29" from="Glen Orchard" to="Bracebridge">
+      <attr name="weight"><int>15</int></attr>
+    </edge>
+    <edge id="e30" from="Sprucedale" to="Kearny">
+      <attr name="weight"><int>13</int></attr>
+    </edge>
+    <edge id="e31" from="Sprucedale" to="Magnetawan">
+      <attr name="weight"><int>20</int></attr>
+    </edge>
+    <edge id="e32" from="Sprucedale" to="Novar">
+      <attr name="weight"><int>18</int></attr>
+    </edge>
+    <edge id="e33" from="Sprucedale" to="Huntsville">
+      <attr name="weight"><int>15</int></attr>
+    </edge>
+    <edge id="e34" from="Novar" to="Sprucedale">
+      <attr name="weight"><int>18</int></attr>
+    </edge>
+    <edge id="e35" from="Novar" to="Kearny">
+      <attr name="weight"><int>8</int></attr>
+    </edge>
+    <edge id="e36" from="Novar" to="Huntsville">
+      <attr name="weight"><int>5</int></attr>
+    </edge>
+    <edge id="e37" from="Huntsville" to="Novar">
+      <attr name="weight"><int>5</int></attr>
+    </edge>
+    <edge id="e38" from="Huntsville" to="Sprucedale">
+      <attr name="weight"><int>15</int></attr>
+    </edge>
+    <edge id="e39" from="Huntsville" to="Bracebridge">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e40" from="Huntsville" to="Bent River">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e41" from="Bracebridge" to="Huntsville">
+      <attr name="weight"><int>30</int></attr>
+    </edge>
+    <edge id="e42" from="Bracebridge" to="Glen Orchard">
+      <attr name="weight"><int>15</int></attr>
+    </edge>
+  </graph>
+</gxl>
diff --git a/inst/XML/wag.gxl b/inst/XML/wag.gxl
new file mode 100644
index 0000000..cb4c7bd
--- /dev/null
+++ b/inst/XML/wag.gxl
@@ -0,0 +1,13 @@
+<gxl>
+ <graph edgeids="true" edgemode="undirected">
+  <node id="1"/>
+  <node id="2"/>
+  <node id="3"/>
+  <node id="4"/>
+  <node id="5"/>
+  <edge id="e1" from="1" to="4"/>
+  <edge id="e2" from="1" to="5"/>
+  <edge id="e3" from="2" to="3"/>
+  <edge id="e4" from="2" to="4"/>
+ </graph>
+</gxl>
diff --git a/inst/boostExamples/bfs-example.cpp b/inst/boostExamples/bfs-example.cpp
new file mode 100644
index 0000000..367e257
--- /dev/null
+++ b/inst/boostExamples/bfs-example.cpp
@@ -0,0 +1,96 @@
+//=======================================================================
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, Indiana University,
+// Bloomington, IN 47405.
+//
+// Permission to modify the code and to distribute the code is
+// granted, provided the text of this NOTICE is retained, a notice if
+// the code was modified is included with the above COPYRIGHT NOTICE
+// and with the COPYRIGHT NOTICE in the LICENSE file, and that the
+// LICENSE file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/breadth_first_search.hpp>
+#include <boost/pending/indirect_cmp.hpp>
+#include <boost/pending/integer_range.hpp>
+#include <iostream>
+
+using namespace boost;
+template < typename TimeMap > class bfs_time_visitor:public default_bfs_visitor {
+  typedef typename property_traits < TimeMap >::value_type T;
+public:
+  bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
+  template < typename Vertex, typename Graph >
+    void discover_vertex(Vertex u, const Graph & g) const
+  {
+    put(m_timemap, u, m_time++);
+  }
+  TimeMap m_timemap;
+  T & m_time;
+};
+
+
+int
+main()
+{
+  using namespace boost;
+  // Select the graph type we wish to use
+  typedef adjacency_list < vecS, vecS, undirectedS > graph_t;
+  // Set up the vertex IDs and names
+  enum { r, s, t, u, v, w, x, y, N };
+  const char *name = "rstuvwxy";
+  // Specify the edges in the graph
+  typedef std::pair < int, int >E;
+  E edge_array[] = { E(r, s), E(r, v), E(s, w), E(w, r), E(w, t),
+    E(w, x), E(x, t), E(t, u), E(x, y), E(u, y)
+  };
+  // Create the graph object
+  const int n_edges = sizeof(edge_array) / sizeof(E);
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+  // VC++ has trouble with the edge iterator constructor
+  graph_t g(N);
+  for (std::size_t j = 0; j < n_edges; ++j)
+    add_edge(edge_array[j].first, edge_array[j].second, g);
+#else
+  typedef graph_traits<graph_t>::vertices_size_type v_size_t;
+  graph_t g(edge_array, edge_array + n_edges, v_size_t(N));
+#endif
+
+  // Typedefs
+  typedef graph_traits < graph_t >::vertex_descriptor Vertex;
+  typedef graph_traits < graph_t >::vertices_size_type Size;
+  typedef Size* Iiter;
+
+  // a vector to hold the discover time property for each vertex
+  std::vector < Size > dtime(num_vertices(g));
+
+  Size time = 0;
+  bfs_time_visitor < Size * >vis(&dtime[0], time);
+  breadth_first_search(g, vertex(s, g), visitor(vis));
+
+  // Use std::sort to order the vertices by their discover time
+  std::vector<graph_traits<graph_t>::vertices_size_type > discover_order(N);
+  integer_range < int >range(0, N);
+  std::copy(range.begin(), range.end(), discover_order.begin());
+  std::sort(discover_order.begin(), discover_order.end(),
+            indirect_cmp < Iiter, std::less < Size > >(&dtime[0]));
+
+  std::cout << "order of discovery: ";
+  for (int i = 0; i < N; ++i)
+    std::cout << name[discover_order[i]] << " ";
+  std::cout << std::endl;
+
+  return EXIT_SUCCESS;
+}
diff --git a/inst/boostExamples/connected_components.cpp b/inst/boostExamples/connected_components.cpp
new file mode 100644
index 0000000..ded5cfe
--- /dev/null
+++ b/inst/boostExamples/connected_components.cpp
@@ -0,0 +1,78 @@
+//=======================================================================
+// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
+// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, University of Notre Dame, Notre
+// Dame, IN 46556.
+//
+// Permission to modify the code and to distribute modified code is
+// granted, provided the text of this NOTICE is retained, a notice that
+// the code was modified is included with the above COPYRIGHT NOTICE and
+// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
+// file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+
+#include <boost/config.hpp>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <utility>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/connected_components.hpp>
+
+/*
+
+  This example demonstrates the usage of the connected_components
+  algorithm on a undirected graph. The example graphs come from
+  "Introduction to Algorithms", Cormen, Leiserson, and Rivest p. 87
+  (though we number the vertices from zero instead of one).
+
+  Sample output:
+
+  Total number of components: 3
+  Vertex 0 is in component 0
+  Vertex 1 is in component 0
+  Vertex 2 is in component 1
+  Vertex 3 is in component 2
+  Vertex 4 is in component 0
+  Vertex 5 is in component 1
+
+ */
+
+using namespace std;
+
+int main(int , char* []) 
+{
+  using namespace boost;
+  {
+    typedef adjacency_list <vecS, vecS, undirectedS> Graph;
+
+    Graph G;
+    add_edge(0, 1, G);
+    add_edge(1, 4, G);
+    add_edge(4, 0, G);
+    add_edge(2, 5, G);
+    
+    std::vector<int> component(num_vertices(G));
+    int num = connected_components(G, &component[0]);
+    
+    std::vector<int>::size_type i;
+    cout << "Total number of components: " << num << endl;
+    for (i = 0; i != component.size(); ++i)
+      cout << "Vertex " << i <<" is in component " << component[i] << endl;
+    cout << endl;
+  }
+  return 0;
+}
+
diff --git a/inst/boostExamples/cycdet.cpp b/inst/boostExamples/cycdet.cpp
new file mode 100644
index 0000000..5ae426d
--- /dev/null
+++ b/inst/boostExamples/cycdet.cpp
@@ -0,0 +1,83 @@
+//=======================================================================
+// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
+// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, University of Notre Dame, Notre
+// Dame, IN 46556.
+//
+// Permission to modify the code and to distribute modified code is
+// granted, provided the text of this NOTICE is retained, a notice that
+// the code was modified is included with the above COPYRIGHT NOTICE and
+// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
+// file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+/*
+
+  Paul Moore's request:
+
+  As an example of a practical problem which is not restricted to graph
+  "experts", consider file dependencies. It's basically graph construction,
+  plus topological sort, but it might make a nice "tutorial" example. Build a
+  dependency graph of files, then use the algorithms to do things like
+  
+  1. Produce a full recompilation order (topological sort, by modified date)
+  2. Produce a "parallel" recompilation order (same as above, but group files
+  which can be built in parallel)
+  3. Change analysis (if I change file x, which others need recompiling)
+  4. Dependency changes (if I add a dependency between file x and file y, what
+  are the effects)
+  
+*/
+
+#include <boost/config.hpp> // put this first to suppress some VC++ warnings
+
+#include <iostream>
+#include <iterator>
+#include <algorithm>
+#include <time.h>
+
+#include <boost/utility.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/topological_sort.hpp>
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/graph/dijkstra_shortest_paths.hpp>
+#include <boost/graph/visitors.hpp>
+
+using namespace std;
+using namespace boost;
+
+
+/* 
+
+struct print_visitor : public bfs_visitor<> {
+  template <class Vertex, class Graph>
+  void discover_vertex(Vertex v, Graph&) {
+    cout << name[v] << " ";
+  }
+};
+
+*/
+
+
+struct cycle_detector : public dfs_visitor<>
+{
+  cycle_detector(bool& has_cycle) 
+    : m_has_cycle(has_cycle) { }
+
+  template <class Edge, class Graph>
+  void back_edge(Edge, Graph&) { m_has_cycle = true; }
+protected:
+  bool& m_has_cycle;
+};
+
diff --git a/inst/boostExamples/dfs-example.cpp b/inst/boostExamples/dfs-example.cpp
new file mode 100644
index 0000000..dbdac14
--- /dev/null
+++ b/inst/boostExamples/dfs-example.cpp
@@ -0,0 +1,113 @@
+//=======================================================================
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, Indiana University,
+// Bloomington, IN 47405.
+//
+// Permission to modify the code and to distribute the code is
+// granted, provided the text of this NOTICE is retained, a notice if
+// the code was modified is included with the above COPYRIGHT NOTICE
+// and with the COPYRIGHT NOTICE in the LICENSE file, and that the
+// LICENSE file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/pending/integer_range.hpp>
+#include <boost/pending/indirect_cmp.hpp>
+#include <boost/graph/graphviz.hpp>
+
+
+#include <iostream>
+using namespace boost;
+template < typename TimeMap > class dfs_time_visitor:public default_dfs_visitor {
+  typedef typename property_traits < TimeMap >::value_type T;
+public:
+  dfs_time_visitor(TimeMap dmap, TimeMap fmap, T & t)
+:  m_dtimemap(dmap), m_ftimemap(fmap), m_time(t) {
+  }
+  template < typename Vertex, typename Graph >
+    void discover_vertex(Vertex u, const Graph & g) const
+  {
+    put(m_dtimemap, u, m_time++);
+  }
+  template < typename Vertex, typename Graph >
+    void finish_vertex(Vertex u, const Graph & g) const
+  {
+    put(m_ftimemap, u, m_time++);
+  }
+  TimeMap m_dtimemap;
+  TimeMap m_ftimemap;
+  T & m_time;
+};
+
+
+int
+main()
+{
+  // Select the graph type we wish to use
+  typedef adjacency_list < vecS, vecS, directedS > graph_t;
+  typedef graph_traits < graph_t >::vertices_size_type size_type;
+  // Set up the vertex names
+  enum
+  { u, v, w, x, y, z, N };
+  char name[] = { 'u', 'v', 'w', 'x', 'y', 'z' };
+  // Specify the edges in the graph
+  typedef std::pair < int, int >E;
+  E edge_array[] = { E(u, v), E(u, x), E(x, v), E(y, x),
+    E(v, y), E(w, y), E(w, z), E(z, z)
+  };
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+  graph_t g(N);  
+  for (std::size_t j = 0; j < sizeof(edge_array) / sizeof(E); ++j)
+    add_edge(edge_array[j].first, edge_array[j].second, g);
+#else
+  graph_t g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N);
+#endif
+
+  // Typedefs
+  typedef boost::graph_traits < graph_t >::vertex_descriptor Vertex;
+  typedef size_type* Iiter;
+
+write_graphviz(std::cout, g);
+
+  // discover time and finish time properties
+  std::vector < size_type > dtime(num_vertices(g));
+  std::vector < size_type > ftime(num_vertices(g));
+  size_type t = 0;
+  dfs_time_visitor < size_type * >vis(&dtime[0], &ftime[0], t);
+
+  depth_first_search(g, visitor(vis));
+
+  // use std::sort to order the vertices by their discover time
+  std::vector < size_type > discover_order(N);
+  integer_range < size_type > r(0, N);
+  std::copy(r.begin(), r.end(), discover_order.begin());
+  std::sort(discover_order.begin(), discover_order.end(),
+            indirect_cmp < Iiter, std::less < size_type > >(&dtime[0]));
+  std::cout << "order of discovery: ";
+  int i;
+  for (i = 0; i < N; ++i)
+    std::cout << name[discover_order[i]] << " ";
+
+  std::vector < size_type > finish_order(N);
+  std::copy(r.begin(), r.end(), finish_order.begin());
+  std::sort(finish_order.begin(), finish_order.end(),
+            indirect_cmp < Iiter, std::less < size_type > >(&ftime[0]));
+  std::cout << std::endl << "order of finish: ";
+  for (i = 0; i < N; ++i)
+    std::cout << name[finish_order[i]] << " ";
+  std::cout << std::endl;
+
+  return EXIT_SUCCESS;
+}
diff --git a/inst/boostExamples/file_dependencies.cpp b/inst/boostExamples/file_dependencies.cpp
new file mode 100644
index 0000000..812d8c3
--- /dev/null
+++ b/inst/boostExamples/file_dependencies.cpp
@@ -0,0 +1,224 @@
+//=======================================================================
+// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
+// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, University of Notre Dame, Notre
+// Dame, IN 46556.
+//
+// Permission to modify the code and to distribute modified code is
+// granted, provided the text of this NOTICE is retained, a notice that
+// the code was modified is included with the above COPYRIGHT NOTICE and
+// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
+// file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+/*
+
+  Paul Moore's request:
+
+  As an example of a practical problem which is not restricted to graph
+  "experts", consider file dependencies. It's basically graph construction,
+  plus topological sort, but it might make a nice "tutorial" example. Build a
+  dependency graph of files, then use the algorithms to do things like
+  
+  1. Produce a full recompilation order (topological sort, by modified date)
+  2. Produce a "parallel" recompilation order (same as above, but group files
+  which can be built in parallel)
+  3. Change analysis (if I change file x, which others need recompiling)
+  4. Dependency changes (if I add a dependency between file x and file y, what
+  are the effects)
+  
+*/
+
+#include <boost/config.hpp> // put this first to suppress some VC++ warnings
+
+#include <iostream>
+#include <iterator>
+#include <algorithm>
+#include <time.h>
+
+#include <boost/utility.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/topological_sort.hpp>
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/graph/dijkstra_shortest_paths.hpp>
+#include <boost/graph/visitors.hpp>
+
+using namespace std;
+using namespace boost;
+
+enum files_e { dax_h, yow_h, boz_h, zow_h, foo_cpp, 
+               foo_o, bar_cpp, bar_o, libfoobar_a,
+               zig_cpp, zig_o, zag_cpp, zag_o, 
+                 libzigzag_a, killerapp, N };
+const char* name[] = { "dax.h", "yow.h", "boz.h", "zow.h", "foo.cpp",
+                       "foo.o", "bar.cpp", "bar.o", "libfoobar.a",
+                       "zig.cpp", "zig.o", "zag.cpp", "zag.o",
+                       "libzigzag.a", "killerapp" };
+
+
+struct print_visitor : public bfs_visitor<> {
+  template <class Vertex, class Graph>
+  void discover_vertex(Vertex v, Graph&) {
+    cout << name[v] << " ";
+  }
+};
+
+
+struct cycle_detector : public dfs_visitor<>
+{
+  cycle_detector(bool& has_cycle) 
+    : m_has_cycle(has_cycle) { }
+
+  template <class Edge, class Graph>
+  void back_edge(Edge, Graph&) { m_has_cycle = true; }
+protected:
+  bool& m_has_cycle;
+};
+
+
+
+
+int main(int,char*[])
+{
+    
+  typedef pair<int,int> Edge;
+  Edge used_by[] = {
+    Edge(dax_h, foo_cpp), Edge(dax_h, bar_cpp), Edge(dax_h, yow_h),
+    Edge(yow_h, bar_cpp), Edge(yow_h, zag_cpp),
+    Edge(boz_h, bar_cpp), Edge(boz_h, zig_cpp), Edge(boz_h, zag_cpp),
+    Edge(zow_h, foo_cpp), 
+    Edge(foo_cpp, foo_o),
+    Edge(foo_o, libfoobar_a),
+    Edge(bar_cpp, bar_o),
+    Edge(bar_o, libfoobar_a),
+    Edge(libfoobar_a, libzigzag_a),
+    Edge(zig_cpp, zig_o),
+    Edge(zig_o, libzigzag_a),
+    Edge(zag_cpp, zag_o),
+    Edge(zag_o, libzigzag_a),
+    Edge(libzigzag_a, killerapp)
+  };
+  const std::size_t nedges = sizeof(used_by)/sizeof(Edge);
+  int weights[nedges];
+  std::fill(weights, weights + nedges, 1);
+
+  typedef adjacency_list<vecS, vecS, directedS, 
+      property<vertex_color_t, default_color_type>,
+      property<edge_weight_t, int>
+    > Graph;
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+  // VC++ can't handle the iterator constructor
+  Graph g(N);
+  property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g);
+  for (std::size_t j = 0; j < nedges; ++j) {
+    graph_traits<Graph>::edge_descriptor e; bool inserted;
+    tie(e, inserted) = add_edge(used_by[j].first, used_by[j].second, g);
+    weightmap[e] = weights[j];
+  }
+#else
+  Graph g(used_by, used_by + nedges, weights, N);
+#endif
+  typedef graph_traits<Graph>::vertex_descriptor Vertex;
+
+  typedef property_map<Graph, vertex_color_t>::type Color;
+
+  // Determine ordering for a full recompilation
+  {
+    typedef list<Vertex> MakeOrder;
+    MakeOrder make_order;
+    topological_sort(g, std::front_inserter(make_order));
+    
+    cout << "make ordering: ";
+    for (MakeOrder::iterator i = make_order.begin();
+         i != make_order.end(); ++i)
+      cout << name[*i] << " ";
+    cout << endl;
+  }
+  cout << endl;
+
+  // Recompilation order with files that can be compiled in parallel
+  // grouped together
+  {
+    // Set up the necessary graph properties.
+    vector<int> time(N);
+    typedef vector<int>::iterator Time;
+    property_map<Graph, edge_weight_t>::type weight = get(edge_weight, g);
+
+    // Calculate the in_degree for each vertex.
+    vector<int> in_degree(N, 0);
+    graph_traits<Graph>::vertex_iterator i, iend;
+    graph_traits<Graph>::out_edge_iterator j, jend;
+    for (tie(i, iend) = vertices(g); i != iend; ++i)
+      for (tie(j, jend) = out_edges(*i,g); j != jend; ++j)
+        in_degree[target(*j,g)] += 1;
+
+    std::greater<int> compare;
+    closed_plus<int> combine;
+
+    // Run best-first-search from each vertex with zero in-degree.
+    for (tie(i, iend) = vertices(g); i != iend; ++i) {
+      if (in_degree[*i] == 0) {
+        std::vector<graph_traits<Graph>::vertex_descriptor> 
+          pred(num_vertices(g));
+        property_map<Graph, vertex_index_t>::type 
+          indexmap = get(vertex_index, g);
+        dijkstra_shortest_paths_no_init
+          (g, *i, &pred[0], &time[0], weight, indexmap, 
+           compare, combine, 0, 0, default_dijkstra_visitor());
+      }
+    }
+
+    cout << "parallel make ordering, " << endl
+         << "vertices with same group number can be made in parallel" << endl;
+    for (tie(i,iend) = vertices(g); i != iend; ++i)
+      cout << "time_slot[" << name[*i] << "] = " << time[*i] << endl;
+  }
+  cout << endl;
+
+  // if I change yow.h what files need to be re-made?
+  {
+    cout << "A change to yow.h will cause what to be re-made?" << endl;
+    print_visitor vis;
+    breadth_first_search(g, vertex(yow_h, g), visitor(vis));
+    cout << endl;
+  }
+  cout << endl;
+
+  // are there any cycles in the graph?
+  {
+    bool has_cycle = false;
+    cycle_detector vis(has_cycle);
+    depth_first_search(g, visitor(vis));
+    cout << "The graph has a cycle? " << has_cycle << endl;
+  }
+  cout << endl;
+
+  // add a dependency going from bar.cpp to dax.h
+  {
+    cout << "adding edge bar_cpp -> dax_h" << endl;
+    add_edge(bar_cpp, dax_h, g);
+  }
+  cout << endl;
+
+  // are there any cycles in the graph?
+  {
+    typedef property_map<Graph,vertex_color_t>::type Color;
+    bool has_cycle = false;
+    cycle_detector vis(has_cycle);
+    depth_first_search(g, visitor(vis));
+    cout << "The graph has a cycle now? " << has_cycle << endl;
+  }
+
+  return 0;
+}
diff --git a/inst/boostExamples/kruskal-example.cpp b/inst/boostExamples/kruskal-example.cpp
new file mode 100644
index 0000000..b7fbcc8
--- /dev/null
+++ b/inst/boostExamples/kruskal-example.cpp
@@ -0,0 +1,86 @@
+//=======================================================================
+// Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee, 
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, Indiana University,
+// Bloomington, IN 47405.
+//
+// Permission to modify the code and to distribute the code is
+// granted, provided the text of this NOTICE is retained, a notice if
+// the code was modified is included with the above COPYRIGHT NOTICE
+// and with the COPYRIGHT NOTICE in the LICENSE file, and that the
+// LICENSE file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/kruskal_min_spanning_tree.hpp>
+#include <fstream>
+#include <iostream>
+
+int
+main()
+{
+  using namespace boost;
+  typedef adjacency_list < vecS, vecS, undirectedS,
+    no_property, property < edge_weight_t, int > > Graph;
+  typedef graph_traits < Graph >::edge_descriptor Edge;
+  typedef graph_traits < Graph >::vertex_descriptor Vertex;
+  typedef std::pair<int, int> E;
+
+  const int num_nodes = 5;
+  E edge_array[] = { E(0, 2), E(1, 3), E(1, 4), E(2, 1), E(2, 3),
+    E(3, 4), E(4, 0), E(4, 1)
+  };
+  int weights[] = { 1, 1, 2, 7, 3, 1, 1, 1 };
+  int num_edges = sizeof(edge_array) / sizeof(E);
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+  Graph g(num_nodes);
+  property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g);
+  for (std::size_t j = 0; j < num_edges; ++j) {
+    Edge e; bool inserted;
+    tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);
+    weightmap[e] = weights[j];
+  }
+#else
+  Graph g(edge_array, edge_array + num_edges, weights, num_nodes);
+#endif
+  property_map < Graph, edge_weight_t >::type weight = get(edge_weight, g);
+  std::vector < Edge > spanning_tree;
+
+  kruskal_minimum_spanning_tree(g, std::back_inserter(spanning_tree));
+
+  std::cout << "Print the edges in the MST:" << std::endl;
+  for (std::vector < Edge >::iterator ei = spanning_tree.begin();
+       ei != spanning_tree.end(); ++ei) {
+    std::cout << source(*ei, g) << " <--> " << target(*ei, g)
+      << " with weight of " << weight[*ei]
+      << std::endl;
+  }
+
+  std::ofstream fout("figs/kruskal-eg.dot");
+  fout << "graph A {\n"
+    << " rankdir=LR\n"
+    << " size=\"3,3\"\n"
+    << " ratio=\"filled\"\n"
+    << " edge[style=\"bold\"]\n" << " node[shape=\"circle\"]\n";
+  graph_traits<Graph>::edge_iterator eiter, eiter_end;
+  for (tie(eiter, eiter_end) = edges(g); eiter != eiter_end; ++eiter) {
+    fout << source(*eiter, g) << " -- " << target(*eiter, g);
+    if (std::find(spanning_tree.begin(), spanning_tree.end(), *eiter)
+        != spanning_tree.end())
+      fout << "[color=\"black\"]\n";
+    else
+      fout << "[color=\"gray\"]\n";
+  }
+  fout << "}\n";
+  return EXIT_SUCCESS;
+}
diff --git a/inst/boostExamples/quick_tour.cpp b/inst/boostExamples/quick_tour.cpp
new file mode 100644
index 0000000..c8d3530
--- /dev/null
+++ b/inst/boostExamples/quick_tour.cpp
@@ -0,0 +1,157 @@
+//=======================================================================
+// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
+// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
+//
+// This file is part of the Boost Graph Library
+//
+// You should have received a copy of the License Agreement for the
+// Boost Graph Library along with the software; see the file LICENSE.
+// If not, contact Office of Research, University of Notre Dame, Notre
+// Dame, IN 46556.
+//
+// Permission to modify the code and to distribute modified code is
+// granted, provided the text of this NOTICE is retained, a notice that
+// the code was modified is included with the above COPYRIGHT NOTICE and
+// with the COPYRIGHT NOTICE in the LICENSE file, and that the LICENSE
+// file is distributed with the modified code.
+//
+// LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
+// By way of example, but not limitation, Licensor MAKES NO
+// REPRESENTATIONS OR WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY
+// PARTICULAR PURPOSE OR THAT THE USE OF THE LICENSED SOFTWARE COMPONENTS
+// OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS
+// OR OTHER RIGHTS.
+//=======================================================================
+
+#include <boost/config.hpp>
+#include <iostream>                      // for std::cout
+#include <utility>                       // for std::pair
+#include <algorithm>                     // for std::for_each
+#include <boost/utility.hpp>             // for boost::tie
+#include <boost/graph/graph_traits.hpp>  // for boost::graph_traits
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graphviz.hpp>
+
+using namespace boost;
+
+template <class Graph> struct exercise_vertex {
+  exercise_vertex(Graph& g_) : g(g_) { }
+  typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+  void operator()(const Vertex& v) const
+  {
+    using namespace boost;
+    typename property_map<Graph, vertex_index_t>::type 
+      vertex_id = get(vertex_index, g);
+    std::cout << "vertex: " << get(vertex_id, v) << std::endl;
+
+    // Write out the outgoing edges
+    std::cout << "\tout-edges: ";
+    typename graph_traits<Graph>::out_edge_iterator out_i, out_end;
+    typename graph_traits<Graph>::edge_descriptor e;
+    for (tie(out_i, out_end) = out_edges(v, g); 
+         out_i != out_end; ++out_i)
+    {
+      e = *out_i;
+      Vertex src = source(e, g), targ = target(e, g);
+      std::cout << "(" << get(vertex_id, src)
+                << "," << get(vertex_id, targ) << ") ";
+    }
+    std::cout << std::endl;
+
+    // Write out the incoming edges    
+    std::cout << "\tin-edges: ";
+    typename graph_traits<Graph>::in_edge_iterator in_i, in_end;
+    for (tie(in_i, in_end) = in_edges(v, g); in_i != in_end; ++in_i)
+    {
+      e = *in_i;
+      Vertex src = source(e, g), targ = target(e, g);
+      std::cout << "(" << get(vertex_id, src)
+                << "," << get(vertex_id, targ) << ") ";
+    }
+    std::cout << std::endl;
+
+    // Write out all adjacent vertices    
+    std::cout << "\tadjacent vertices: ";
+    typename graph_traits<Graph>::adjacency_iterator ai, ai_end;
+    for (tie(ai,ai_end) = adjacent_vertices(v, g);  ai != ai_end; ++ai)
+      std::cout << get(vertex_id, *ai) <<  " ";
+    std::cout << std::endl;
+  }
+  Graph& g;
+};
+
+
+int main(int,char*[])
+{
+  // create a typedef for the Graph type
+  typedef adjacency_list<vecS, vecS, bidirectionalS,
+     no_property, property<edge_weight_t, float> > Graph;
+
+  // Make convenient labels for the vertices
+  enum { A, B, C, D, E, N };
+  const int num_vertices = N;
+  const char* name = "ABCDE";
+
+  // writing out the edges in the graph
+  typedef std::pair<int,int> Edge;
+  Edge edge_array[] = 
+  { Edge(A,B), Edge(A,D), Edge(C,A), Edge(D,C),
+    Edge(C,E), Edge(B,D), Edge(D,E), };
+  const int num_edges = sizeof(edge_array)/sizeof(edge_array[0]);
+
+  // average transmission delay (in milliseconds) for each connection
+  float transmission_delay[] = { 1.2, 4.5, 2.6, 0.4, 5.2, 1.8, 3.3, 9.1 };
+
+  // declare a graph object, adding the edges and edge properties
+#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
+  // VC++ can't handle the iterator constructor
+  Graph g(num_vertices);
+  property_map<Graph, edge_weight_t>::type weightmap = get(edge_weight, g);
+  for (std::size_t j = 0; j < num_edges; ++j) {
+    graph_traits<Graph>::edge_descriptor e; bool inserted;
+    tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);
+    weightmap[e] = transmission_delay[j];
+  }
+#else
+  Graph g(edge_array, edge_array + num_edges,
+          transmission_delay, num_vertices);
+#endif
+
+  boost::property_map<Graph, vertex_index_t>::type 
+    vertex_id = get(vertex_index, g);
+  boost::property_map<Graph, edge_weight_t>::type
+    trans_delay = get(edge_weight, g);
+
+  std::cout << "vertices(g) = ";
+  typedef graph_traits<Graph>::vertex_iterator vertex_iter;
+  std::pair<vertex_iter, vertex_iter> vp;
+  for (vp = vertices(g); vp.first != vp.second; ++vp.first)
+    std::cout << name[get(vertex_id, *vp.first)] <<  " ";
+  std::cout << std::endl;
+  
+  std::cout << "edges(g) = ";
+  graph_traits<Graph>::edge_iterator ei, ei_end;
+  for (tie(ei,ei_end) = edges(g); ei != ei_end; ++ei)
+    std::cout << "(" << name[get(vertex_id, source(*ei, g))]
+              << "," << name[get(vertex_id, target(*ei, g))] << ") ";
+  std::cout << std::endl;
+  
+  std::for_each(vertices(g).first, vertices(g).second,
+                exercise_vertex<Graph>(g));
+  
+  std::map<std::string,std::string> graph_attr, vertex_attr, edge_attr;
+  graph_attr["size"] = "3,3";
+  graph_attr["rankdir"] = "LR";
+  graph_attr["ratio"] = "fill";
+  vertex_attr["shape"] = "circle";
+
+  boost::write_graphviz(std::cout, g, 
+                        make_label_writer(name),
+                        make_label_writer(trans_delay),
+                        make_graph_attributes_writer(graph_attr, vertex_attr, 
+                                                     edge_attr));
+  
+  return 0;
+}
+
+
diff --git a/inst/demos/dem1.R b/inst/demos/dem1.R
new file mode 100644
index 0000000..b02269d
--- /dev/null
+++ b/inst/demos/dem1.R
@@ -0,0 +1,17 @@
+demCC <- function(nnodes=500, inM=1:2, p=.3)
+ {
+ library(graph)
+ library(RBGL)
+ library(Biobase)
+gt <- system.time(x <- randomGraph( as.character(1:nnodes), inM, p ))
+ct <- system.time(cx <- connectedComp(x))
+nn <- length(nodes(x))
+ne <- sum(listLen(edges(x))/2)
+c("nnodes"=nn, "nedges"=ne, ncc=length(cx), graphTime=gt[3], ccTime=ct[3])
+}
+set.seed(1234)
+print(demCC())
+print(demCC(1000))
+print(demCC(2000))
+
+
diff --git a/inst/demos/dem1.out b/inst/demos/dem1.out
new file mode 100644
index 0000000..08ace98
--- /dev/null
+++ b/inst/demos/dem1.out
@@ -0,0 +1,45 @@
+
+R : Copyright 2003, The R Foundation for Statistical Computing
+Version 1.9.0 Under development (unstable) (2003-11-04), ISBN 3-900051-00-3
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for a HTML browser interface to help.
+Type 'q()' to quit R.
+
+> demCC <- function(nnodes=500, inM=1:2, p=.3)
++  {
++  library(graph)
++  library(RBGL)
++  library(Biobase)
++ gt <- system.time(x <- randomGraph( as.character(1:nnodes), inM, p ))
++ ct <- system.time(cx <- connectedComp(x))
++ nn <- length(nodes(x))
++ ne <- sum(listLen(edges(x))/2)
++ c("nnodes"=nn, "nedges"=ne, ncc=length(cx), graphTime=gt[3], ccTime=ct[3])
++ }
+> set.seed(1234)
+> print(demCC())
+Welcome to Bioconductor 
+	 Vignettes contain introductory material.  To view, 
+	 simply type: openVignette() 
+	 For details on reading vignettes, see
+	 the openVignette help page.
+   nnodes    nedges       ncc graphTime    ccTime 
+   500.00  21958.00    238.00     10.96      1.53 
+> print(demCC(1000))
+   nnodes    nedges       ncc graphTime    ccTime 
+  1000.00  78479.00    519.00     50.59      6.29 
+> print(demCC(2000))
+   nnodes    nedges       ncc graphTime    ccTime 
+  2000.00 340668.00    974.00    366.41     31.04 
+> 
+> 
+> 
diff --git a/inst/demos/vcshort.R b/inst/demos/vcshort.R
new file mode 100644
index 0000000..6e1f4a9
--- /dev/null
+++ b/inst/demos/vcshort.R
@@ -0,0 +1,203 @@
+##Copyright R. Gentleman, 2003, all rights reserved
+
+
+library(Biobase)
+library(hgu95av2)
+
+#load(paste(homedir, "Genetics/Sabina/Data143/ALL.rda", sep="/"))
+load("ALL.rda")
+
+Bs <- grep("^B", as.character(ALL$BT))
+
+ALLsB <- ALL[,Bs]
+
+ALLs <- ALLsB$mol == "BCR/ABL" | ALLsB$mol == "NEG"
+
+##here is our subset of interest
+
+BCRNEGsub <- ALLsB[,ALLs]
+
+
+##first do some simple filtering....
+
+library(genefilter)
+
+##old filters
+##  f1 <- pOverA(.1, 100)
+##  f2 <- gapFilter(10, 150, .1)
+f1 <- pOverA(.25, 300)
+f2 <- gapFilter(200, 250, .1)
+
+ff <- filterfun(f1, f2)
+
+wh <- genefilter(BCRNEGsub, ff)
+
+sum(wh)  ##got 5421 genes
+
+##
+BNsub <- BCRNEGsub[wh,]
+
+##now we need to drop all probe sets that have duplicate
+##LLIDs - since we don't know what to do with them; for
+##now we just take the first, but users should do something more
+##sensible
+
+gN <- geneNames(BNsub)
+
+library(annotate)
+
+##FIXME:
+##didn't handle the NA's here properly!
+##also need to drop the AFFX* genes!
+gLL <- getLL(gN, "hgu95av2")
+wh2 <- !duplicated(gLL)
+BNsub <- BNsub[wh2,]
+
+##it might also make sense to drop those genes for which we have
+##no GO annotation, but lets wait till a bit later on
+
+
+##now lets split this into two and make some graphs
+##should have about 4461 genes left
+
+Bsub <- BNsub[, BNsub$mol=="BCR/ABL"]
+Nsub <- BNsub[, BNsub$mol=="NEG"]
+
+gN <- geneNames(Bsub)
+
+##now we need to see if we can compute the correlations -
+##might be too big
+
+cB <- cor(t(exprs(Bsub)))
+cB[-.6 < cB & cB < 0.6] <- 0
+
+##drop the selfloops
+diag(cB) <- 0
+
+##restart
+if( !exists("cB") ) {
+    setwd(homedir)
+    load("cB.rda")
+}
+
+##this one is about 5% of the size...
+library(SparseM)
+v1<-as.matrix.csr(cB, nr=dim(cB)[1], nc=dim(cB)[2])
+
+##check how many non-zero entries
+length(v1 at ra)
+
+save(v1, file="v1.rda")
+
+rm(cB)
+
+library(graph)
+
+##take a sparse matrix - csr and put it into a graph
+sparseM2Graph <- function(sM, nodeNames) {
+    nN <- dim(sM)[1]
+    dd <- diff(sM at ia)
+    e1 <- rep(1:nN, dd)
+    eL <- split(sM at ja, e1)
+    eW <- split(sM at ra, e1)
+
+    edL <- vector("list", length=nN)
+    names(edL) <- 1:nN
+    for(i in as.character(1:nN) ){
+        edL[[i]] <- list(edges=eL[[i]], weights=eW[[i]])
+    }
+    names(edL) <- nodeNames
+    new("graphNEL", nodes=nodeNames, edgeL=edL)
+}
+
+##translate a graph to a SparseMatrix:
+##ra - the values; these will be 1's for now
+##ja - the column indices
+##ia the row offsets (
+graph2SparseM <- function(g, useweights=FALSE) {
+    nr = nc = numNodes(g)
+    e1 = g at edgeL
+    e2 = lapply(e1, function(x) x$edges)
+    eL = listLen(e2)
+    if( useweights )
+        ra = unlist(lapply(e1, function(x) x$weights))
+    else
+        ra = rep(1, sum(eL))
+    ja = as.integer(unlist(e2))
+    ia = as.integer(cumsum(c(1, eL)))
+    new("matrix.csr", ra=ra, ja=ja, ia=ia, dimension=c(nr, nc))
+}
+
+#if( exists("debug") && debug == TRUE) {
+#    debug(graph2SparseM)
+
+#    ss1 <- graph2SparseM(gR) 
+# gX = sparseM2Graph(ss1)
+    
+#}
+##seems we need to set the names to be affy probes or we will have
+##trouble later on
+
+Bsub.g1 <- sparseM2Graph(v1, gN)
+
+save(Bsub.g1, file="Bsub.g1.rda")
+
+if( !exists("Bsub.g1") ) {
+    setwd(homedir)
+    library(graph)
+    load("Bsub.g1.rda")
+    gN <- nodes(Bsub.g1)
+    library(hgu95av2)
+}
+
+##some tests
+EM1 <- edgeMatrix(Bsub.g1)
+EW1 <- eWV(Bsub.g1, EM1)
+
+##lets see if/what is connected to what
+##and it seems to take forever...
+library(RBGL)
+
+
+  cc1 <- connectedComp(Bsub.g1)
+
+# vcshort.R -- mods to RG's ShortestPath.R that assume
+# that you have ALL.rda in the working dir
+
+##now lets find some transcription factors:
+#
+#
+#
+
+library(GO)
+
+##we select:
+##GO:0003700  ##MF: "transcription factor activity"
+
+whTFs <- get("GO:0003700", hgu95av2GO2ALLPROBES)
+
+have <- match(gN, whTFs,0)
+
+ourTFs <- gN[have]
+
+##this seems to be way too slow,
+##is it vectorized?
+sG1 <- subGraph(nodes(Bsub.g1)[1:200], Bsub.g1)
+cc1 <- connectedComp(sG1)
+sG2 <- subGraph(cc1[[2]], sG1)
+
+#vvX <- dijkstra.sp(sG2, ourTFs[225])
+
+# now it seems that negative distances are a problem for boost
+# dijkstra implementations.  to get positive distances, use 1-r
+
+tmp <- lapply( Bsub.g1 at edgeL, function(x) 1-x$weights )
+for (i in 1:length(Bsub.g1 at edgeL)) Bsub.g1 at edgeL[[i]]$weights <- tmp[[i]]
+
+
+# sadly, dijkstra.sp wants a numerical second arg!
+# since the first node has no neighbors, use second...
+vv <- dijkstra.sp(Bsub.g1, 2)
+print(summary(vv$distances))
+#
+print(sp.between(Bsub.g1, ourTFs[1], ourTFs[2]))
diff --git a/inst/doc/RBGL.R b/inst/doc/RBGL.R
new file mode 100644
index 0000000..cb52810
--- /dev/null
+++ b/inst/doc/RBGL.R
@@ -0,0 +1,515 @@
+### R code from vignette source 'RBGL.Rnw'
+
+###################################################
+### code chunk number 1: RBGL.Rnw:44-47
+###################################################
+library(RBGL)
+library(Rgraphviz)
+library(XML)
+
+
+###################################################
+### code chunk number 2: bfDemo
+###################################################
+con <- file(system.file("XML/bfsex.gxl", package="RBGL"))
+bf <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 3: figbf
+###################################################
+  plot(bf, main="a) Breath-First Search Example")
+
+
+###################################################
+### code chunk number 4: dfDemo
+###################################################
+con <- file(system.file("XML/dfsex.gxl", package="RBGL"))
+df <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 5: figdf
+###################################################
+  plot(df, main="b) Depth-First Search Example")
+
+
+###################################################
+### code chunk number 6: dijkstraDemo
+###################################################
+con <- file(system.file("XML/dijkex.gxl", package="RBGL"))
+dijk <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 7: figdijk
+###################################################
+ plot(dijk, main="c) Dijkstra's Example")
+
+
+###################################################
+### code chunk number 8: connDemo
+###################################################
+con <- file(system.file("XML/conn.gxl", package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 9: figcoex
+###################################################
+ plot(coex, main="d) Coex Example")
+
+
+###################################################
+### code chunk number 10: conn2Demo
+###################################################
+con <- file(system.file("XML/conn2.gxl", package="RBGL"))
+coex2 <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 11: figcoex2
+###################################################
+  plot(coex2, main="e) Coex2 Example")
+
+
+###################################################
+### code chunk number 12: conn2iDemo
+###################################################
+con <- file(system.file("XML/conn2iso.gxl", package="RBGL"))
+coex2i <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 13: figcoex2i
+###################################################
+  plot(coex2i, main="f) Coex2 Isomorphism Example")
+
+
+###################################################
+### code chunk number 14: kmstDemo
+###################################################
+con <- file(system.file("XML/kmstEx.gxl", package="RBGL"))
+km <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 15: figkmst
+###################################################
+  plot(km, main="g) Kruskal MST Example")
+
+
+###################################################
+### code chunk number 16: bicoDemo
+###################################################
+con <- file(system.file("XML/biconn.gxl", package="RBGL"))
+bicoex <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 17: figbico
+###################################################
+  plot(bicoex, main="h) Biconnected Component Example")
+
+
+###################################################
+### code chunk number 18: ospfDemo
+###################################################
+con <- file(system.file("XML/ospf.gxl", package="RBGL"))
+ospf <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 19: figospf
+###################################################
+  plot(ospf, main="i) Ospf Example")
+
+
+###################################################
+### code chunk number 20: zzDemo
+###################################################
+con <- file(system.file("dot/joh.gxl", package="RBGL"))
+joh <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 21: figjoh
+###################################################
+  plot(joh, main="j) joh Example")
+
+
+###################################################
+### code chunk number 22: hcsDemo
+###################################################
+con <- file(system.file("XML/hcs.gxl", package="RBGL"))
+hcs <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 23: fighcs
+###################################################
+  plot(hcs, main="k) HCS Example")
+
+
+###################################################
+### code chunk number 24: kclexDemo
+###################################################
+con <- file(system.file("XML/snacliqueex.gxl", package="RBGL"))
+kclex <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 25: figkclex
+###################################################
+  plot(kclex, main="l) kCliques Example")
+
+
+###################################################
+### code chunk number 26: kcoexDemo
+###################################################
+con <- file(system.file("XML/snacoreex.gxl", package="RBGL"))
+kcoex <- fromGXL(con)
+close(con)
+
+
+###################################################
+### code chunk number 27: figkcoex
+###################################################
+  plot(kcoex, main="m) kCores Example")
+
+
+###################################################
+### code chunk number 28: showFileDep
+###################################################
+data(FileDep)
+FileDep
+
+
+###################################################
+### code chunk number 29: figfd
+###################################################
+z <- plot(FileDep)
+
+
+###################################################
+### code chunk number 30: DFSdemo
+###################################################
+print(dfs.res <- dfs(df, "y"))
+
+
+###################################################
+### code chunk number 31: figdfs1
+###################################################
+plot(df, main="a) DFS Example")
+
+
+###################################################
+### code chunk number 32: figdfs2
+###################################################
+dfsNattrs <- makeNodeAttrs(df)
+dfsNattrs$label[dfs.res$discovered] <- 1:numNodes(df)
+plot(df, nodeAttrs=dfsNattrs, main="b) DFS Example with search order")
+
+
+###################################################
+### code chunk number 33: BFSdemo
+###################################################
+print(bfs.res <- bfs(bf,"s"))
+
+
+###################################################
+### code chunk number 34: figbfs1
+###################################################
+plot(bf, main="a) BFS Example")
+
+
+###################################################
+### code chunk number 35: figbfs2
+###################################################
+bfsNattrs <- makeNodeAttrs(bf)
+bfsNattrs$label[bfs.res] <- 1:numNodes(bf)
+plot(bf, nodeAttrs=bfsNattrs, main="b) BFS Example with search order")
+
+
+###################################################
+### code chunk number 36: dijkdemo1
+###################################################
+nodes(dijk)
+edgeWeights(dijk)
+dijkstra.sp(dijk)
+
+
+###################################################
+### code chunk number 37: dijkdemo2
+###################################################
+nodes(ospf)[6]
+dijkstra.sp(ospf,nodes(ospf)[6])
+sp.between(ospf, "RT6", "RT1")
+
+
+###################################################
+### code chunk number 38: figospf
+###################################################
+z <- plot(ospf)
+
+
+###################################################
+### code chunk number 39: bellmanfordDemo
+###################################################
+dd <- coex2
+nodes(dd)
+bellman.ford.sp(dd)
+bellman.ford.sp(dd,nodes(dd)[2])
+
+
+###################################################
+### code chunk number 40: DAGDemo
+###################################################
+dd <- coex2
+dag.sp(dd)
+dag.sp(dd,nodes(dd)[2])
+
+
+###################################################
+### code chunk number 41: johnsonDemo
+###################################################
+zz <- joh
+edgeWeights(zz)
+johnson.all.pairs.sp(zz)
+
+
+###################################################
+### code chunk number 42: figjoh
+###################################################
+z <- plot(zz)
+
+
+###################################################
+### code chunk number 43: floydwarshallDemo
+###################################################
+floyd.warshall.all.pairs.sp(coex)
+
+
+###################################################
+### code chunk number 44: KMSTdemo
+###################################################
+mstree.kruskal(km)
+
+
+###################################################
+### code chunk number 45: primDemo
+###################################################
+mstree.prim(coex2)
+
+
+###################################################
+### code chunk number 46: conndemo
+###################################################
+km1 <- km
+km1 <- graph::addNode(c("F","G","H"), km1)
+km1 <- addEdge("G", "H", km1, 1)
+km1 <- addEdge("H", "G", km1, 1)
+connectedComp(ugraph(km1))
+
+
+###################################################
+### code chunk number 47: figkm1
+###################################################
+plot(km1, main="Modified Kruskal MST example")
+
+
+###################################################
+### code chunk number 48: sconndemo
+###################################################
+km2 <- km
+km2 <- graph::addNode(c("F","G","H"), km2)
+km2 <- addEdge("G", "H", km2, 1)
+km2 <- addEdge("H", "G", km2, 1)
+strongComp(km2)
+
+
+###################################################
+### code chunk number 49: biConnCompdemo
+###################################################
+biConnComp(bicoex)
+articulationPoints(bicoex)
+
+
+###################################################
+### code chunk number 50: figbicoex
+###################################################
+z <- plot(bicoex)
+
+
+###################################################
+### code chunk number 51: incrCompdemo
+###################################################
+jcoex <- join(coex, hcs)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "F")
+same.component(jcoex, "A", "A1")
+jcoex <- addEdge("A", "A1", jcoex)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "A1")
+
+
+###################################################
+### code chunk number 52: figjcoex
+###################################################
+z <- plot(jcoex)
+
+
+###################################################
+### code chunk number 53: MaxFlowdemo
+###################################################
+edgeWeights(dijk)
+edmonds.karp.max.flow(dijk, "B", "D")
+push.relabel.max.flow(dijk, "C", "B")
+
+
+###################################################
+### code chunk number 54: SparseMatrixOrderingdemo
+###################################################
+dijk1 <- ugraph(dijk)
+cuthill.mckee.ordering(dijk1)
+minDegreeOrdering(dijk1)
+sloan.ordering(dijk1)
+
+
+###################################################
+### code chunk number 55: edgeConndemo
+###################################################
+edgeConnectivity(coex)
+
+
+###################################################
+### code chunk number 56: tsortDemo1
+###################################################
+tsort(FileDep)
+
+
+###################################################
+### code chunk number 57: tsortDemo2
+###################################################
+FD2 <- FileDep
+# now introduce a cycle
+FD2 <- addEdge(from="bar_o", to="dax_h", FD2)
+tsort(FD2)
+
+
+###################################################
+### code chunk number 58: Isomorphismdemo
+###################################################
+isomorphism(dijk, coex2)
+isomorphism(coex2i, coex2)
+
+
+###################################################
+### code chunk number 59: figcoex2i
+###################################################
+z <- plot(coex2i)
+
+
+###################################################
+### code chunk number 60: VertexColoringdemo
+###################################################
+sequential.vertex.coloring(coex)
+
+
+###################################################
+### code chunk number 61: wavefrontdemo
+###################################################
+ss <- 1
+ith.wavefront(dijk, ss)
+maxWavefront(dijk)
+aver.wavefront(dijk)
+rms.wavefront(dijk)
+
+
+###################################################
+### code chunk number 62: Centralitydemo
+###################################################
+brandes.betweenness.centrality(coex)
+betweenness.centrality.clustering(coex, 0.1, TRUE)
+
+
+###################################################
+### code chunk number 63: mincutdemo
+###################################################
+minCut(coex)
+
+
+###################################################
+### code chunk number 64: highlyConnSGdemo
+###################################################
+highlyConnSG(coex)
+highlyConnSG(hcs)
+
+
+###################################################
+### code chunk number 65: MaxCliquedemo
+###################################################
+maxClique(coex)
+maxClique(hcs)
+
+
+###################################################
+### code chunk number 66: IsTriangulateddemo
+###################################################
+is.triangulated(coex)
+is.triangulated(hcs)
+
+
+###################################################
+### code chunk number 67: Separatesdemo
+###################################################
+separates("B", "A", "E", km)
+separates("B", "A", "C", km)
+
+
+###################################################
+### code chunk number 68: kCoresdemo1
+###################################################
+kCores(kcoex)
+kcoex2 <- coex2
+kCores(kcoex2)
+kCores(kcoex2, "in")
+kCores(kcoex2, "out")
+g1 <- addEdge("C", "B", kcoex2)
+kCores(g1, "in")
+g2 <- addEdge("C", "A", kcoex2)
+kCores(g2, "out")
+
+
+###################################################
+### code chunk number 69: figkcores
+###################################################
+z <- plot(kcoex)
+
+
+###################################################
+### code chunk number 70: kCliquesdemo
+###################################################
+kCliques(kclex)
+
+
+###################################################
+### code chunk number 71: figkcliques
+###################################################
+z <- plot(kclex)
+
+
diff --git a/inst/doc/RBGL.Rnw b/inst/doc/RBGL.Rnw
new file mode 100644
index 0000000..7b60a8d
--- /dev/null
+++ b/inst/doc/RBGL.Rnw
@@ -0,0 +1,1197 @@
+%
+% NOTE -- ONLY EDIT RBGL.Rnw!!!
+% RBGL.tex file will get overwritten.
+%
+%\VignetteIndexEntry{RBGL Overview}
+%\VignetteDepends{graph}
+%\VignetteKeywords{Graphs}
+%\VignettePackage{RBGL}
+
+\documentclass[12pt]{article}
+
+\usepackage{amsmath}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\newcommand\Rpackage[1]{{\textsf{#1}\index{#1 (package)}}}
+\newcommand\RpackageNoindex[1]{{\textsf{#1}}}
+\newcommand\Rclass[1]{{\textit{#1}\index{#1 (class)}}}
+\newcommand\Rfunction[1]{{{\small\texttt{#1}}\index{#1 (function)}}}
+\newcommand\Rmethod[1]{{\small\texttt{#1}}}
+\newcommand\Rcommand[1]{{{\small\texttt{#1}}\index{#1 (function)}}}
+\newcommand\Rfunarg[1]{{\small\texttt{#1}}}
+\newcommand\Robject[1]{{\small\texttt{#1}}}
+
+
+%\setkeys{Gin}{width=0.55\textwidth}
+
+
+\bibliographystyle{plainnat}
+
+\begin{document}
+
+<<echo=false, results=hide>>=
+library(RBGL)
+library(Rgraphviz)
+library(XML)
+@
+
+\title{{\it RBGL}: R interface to boost graph library}
+\author{L. Long, VJ Carey, and R. Gentleman}
+\maketitle
+
+\begin{quotation} {\it Summary}.
+The \Rpackage{RBGL} package is primarily
+an interface from R to the Boost Graph Library (BGL).
+It includes some graph algorithms built on top of those from BGL and
+some algorithms independent of BGL.
+\end{quotation}
+
+\tableofcontents
+
+\section{Basic notations/Preliminaries}
+
+\subsection{Basics Notations}
+
+We use the following notation:
+
+{\em G}: a graph, represented as G = (V, E);
+{\em V} = {v1, v2, ..., vn}: a set of vertices (or nodes);
+{\em E} = {e1, e2, ..., em}: a set of edges with ei = [vj, vk], with vj, vk are in V;
+{\em W} = {w1, w2, ..., wm}: a set of weights of the edges, i.e., wi is the weight on edge ei.
+
+A {\em walk} is a sequence of vertices {v1, v2, ..., vk} such that for all i, [vi, vi+1] in {\em E}.
+A {\em path} is a walk without repeated vertices.
+A {\em cycle} is a path that begins and ends at the same vertice.
+
+A {\em directed} graph is a graph with direction assigned to its edges, therefore, [vj, vk] != [vk, vj].
+
+A {\em directed acyclic graph (DAG)} is a directed graph with no directed cycle.
+
+An {\em in-degree} of vertex v is the total number of edges [u, v] in E; an {\em out-degree} of v is the total number of edges [v, u] in {\em E}.
+
+A network {\em N} is a directed graph {\em G} with (a) a source {\em s} whose in-degree is 0,
+(b) a sink {\em t} whose out-degree is 0, and
+(c) a {\em capacity} for each edge in a network.
+
+A {\em flow} in {\em N} assigns a value on each edge that doesn't exceed its capacity,
+all the internal vertices have the same incoming flow as the outgoing flow,
+{\em s} has outgoing flow only, {\em t} has incoming flow only.
+
+
+\subsection{Examples in use}
+We are going to use the following graphs repeatedly in the examples.
+
+<<bfDemo>>=
+con <- file(system.file("XML/bfsex.gxl", package="RBGL"))
+bf <- fromGXL(con)
+close(con)
+@
+
+<<figbf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(bf, main="a) Breath-First Search Example")
+@
+
+<<dfDemo>>=
+con <- file(system.file("XML/dfsex.gxl", package="RBGL"))
+df <- fromGXL(con)
+close(con)
+@
+
+<<figdf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(df, main="b) Depth-First Search Example")
+@
+
+<<dijkstraDemo>>=
+con <- file(system.file("XML/dijkex.gxl", package="RBGL"))
+dijk <- fromGXL(con)
+close(con)
+@
+
+<<figdijk, fig=TRUE, echo=FALSE, results=hide, include=FALSE>>=
+ plot(dijk, main="c) Dijkstra's Example")
+@
+
+<<connDemo>>=
+con <- file(system.file("XML/conn.gxl", package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+@
+
+<<figcoex, fig=TRUE, echo=FALSE, results=hide, include=FALSE>>=
+ plot(coex, main="d) Coex Example")
+@
+
+<<conn2Demo>>=
+con <- file(system.file("XML/conn2.gxl", package="RBGL"))
+coex2 <- fromGXL(con)
+close(con)
+@
+
+<<figcoex2, fig=TRUE, echo=FALSE, results=hide, include=FALSE >>=
+  plot(coex2, main="e) Coex2 Example")
+@
+
+<<conn2iDemo>>=
+con <- file(system.file("XML/conn2iso.gxl", package="RBGL"))
+coex2i <- fromGXL(con)
+close(con)
+@
+
+<<figcoex2i, fig=TRUE, echo=FALSE, results=hide, include=FALSE >>=
+  plot(coex2i, main="f) Coex2 Isomorphism Example")
+@
+
+<<kmstDemo>>=
+con <- file(system.file("XML/kmstEx.gxl", package="RBGL"))
+km <- fromGXL(con)
+close(con)
+@
+
+<<figkmst, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(km, main="g) Kruskal MST Example")
+@
+
+<<bicoDemo>>=
+con <- file(system.file("XML/biconn.gxl", package="RBGL"))
+bicoex <- fromGXL(con)
+close(con)
+@
+
+<<figbico, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(bicoex, main="h) Biconnected Component Example")
+@
+
+<<ospfDemo>>=
+con <- file(system.file("XML/ospf.gxl", package="RBGL"))
+ospf <- fromGXL(con)
+close(con)
+@
+
+<<figospf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(ospf, main="i) Ospf Example")
+@
+
+<<zzDemo>>=
+con <- file(system.file("dot/joh.gxl", package="RBGL"))
+joh <- fromGXL(con)
+close(con)
+@
+
+<<figjoh, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(joh, main="j) joh Example")
+@
+
+<<hcsDemo>>=
+con <- file(system.file("XML/hcs.gxl", package="RBGL"))
+hcs <- fromGXL(con)
+close(con)
+@
+
+<<fighcs, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(hcs, main="k) HCS Example")
+@
+
+<<kclexDemo>>=
+con <- file(system.file("XML/snacliqueex.gxl", package="RBGL"))
+kclex <- fromGXL(con)
+close(con)
+@
+
+<<figkclex, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(kclex, main="l) kCliques Example")
+@
+
+<<kcoexDemo>>=
+con <- file(system.file("XML/snacoreex.gxl", package="RBGL"))
+kcoex <- fromGXL(con)
+close(con)
+@
+
+<<figkcoex, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(kcoex, main="m) kCores Example")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figbf} &
+\includegraphics[width=0.49\textwidth]{RBGL-figdf} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figdijk} &
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (I). }
+\end{figure}
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex2} &
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex2i} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figkmst} &
+\includegraphics[width=0.49\textwidth]{RBGL-figbico} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (II). }
+\end{figure}
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-fighcs} &
+\includegraphics[width=0.49\textwidth]{RBGL-figkclex} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figkcoex} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (III). }
+\end{figure}
+
+\section{Working with the Bioconductor {\tt graph} class}
+An example object representing file dependencies is included, as shown
+in Figure \ref{fdpic}.
+
+<<showFileDep>>=
+data(FileDep)
+FileDep
+@
+\begin{figure}
+<<figfd, fig=TRUE, echo=false>>=
+z <- plot(FileDep)
+@
+%\includegraphics{filedep}
+\caption{File dependency digraph example from Boost library.}
+\label{fdpic}
+\end{figure}
+
+\section{Algorithms from BGL}
+
+\subsection{Depth First Search}
+
+The \Rfunction{dfs} function returns two vectors of node names of 
+discovery and finish order in a depth-first-search (DFS), starting at the 
+given vertex.
+
+<<DFSdemo>>=
+print(dfs.res <- dfs(df, "y"))
+@
+
+In this example, DFS starts with {\em y}, reaches {\em x} and {\em v}; 
+DFS restarts from {\em w}, reaches {\em z}; 
+DFS restarts from {\em u}; at this point, all the vertices in the graph are
+visited once and only once.  You could see the search order in the figure.
+
+<<figdfs1, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+plot(df, main="a) DFS Example")
+@
+
+<<figdfs2, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+dfsNattrs <- makeNodeAttrs(df)
+dfsNattrs$label[dfs.res$discovered] <- 1:numNodes(df)
+plot(df, nodeAttrs=dfsNattrs, main="b) DFS Example with search order")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figdfs1}&
+\includegraphics[width=0.49\textwidth]{RBGL-figdfs2} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:dfsex}%
+a) The graph for depth-first-search example.
+b) The graph for depth-first-search example, showing search orders.}
+\end{figure}
+
+\subsection{Breadth First Search}
+
+The \Rfunction{bfs} function returns a vector of node names of discovery order
+in a breadth-first search (BFS), starting at the given vertex. 
+
+<<BFSdemo>>=
+print(bfs.res <- bfs(bf,"s"))
+@
+
+In this example, BFS starts from vertex {\em s}, reaches {\em w}; 
+from {\em w} BFS reaches {\em r}, {\em t} and {\em x}; 
+from {\em r} BFS reaches {\em v}; 
+from {\em t} BFS reaches {\em u}; 
+from {\em x} BFS reaches {\em y};
+at this time, BFS visits all the vertices in the graph once and only once.
+ 
+<<figbfs1, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+plot(bf, main="a) BFS Example")
+@
+
+<<figbfs2, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+bfsNattrs <- makeNodeAttrs(bf)
+bfsNattrs$label[bfs.res] <- 1:numNodes(bf)
+plot(bf, nodeAttrs=bfsNattrs, main="b) BFS Example with search order")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figbfs1}&
+\includegraphics[width=0.49\textwidth]{RBGL-figbfs2} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:bfsex}%
+a) The graph for breadth-first-search example.
+b) The graph for breadth-first-search example, showing search orders.}
+\end{figure}
+
+\subsection{Shortest paths}
+
+Edge weights play a major role in shortest-path problems.
+The weight of an edge in a graph could represent the relationship between the
+two vertices, such as distance, probability, etc.  
+
+TO-BE-FINALIZED:
+Our knowledge of such a relationship between two vertices is:
+(1) we know there is an edge and there is a measured value on it;
+(2) we know there is an edge but there is NO measured value on it;
+(3) we know there is NO edge;
+(4) we DO NOT know if there is an edge. 
+
+Corresponding edge weights are:
+case 1: measured value;
+case 2: \Robject{NA};  
+case 3: \Robject{Inf};
+case 4: TO-BE-DETERMINED
+
+When there is a loop of negative weight between two vertices, the distance
+between them is \Robject{-Inf}.
+
+%%FIXME: yes, but I think not available is different than you are
+%%using it here. Vince seemed to have in mind the idea that there
+%%would be some subject matter knowledge that a node exists, but it
+%%has not yet been measured.
+
+The shortest path problem is to find a path between two vertices where the
+sum of all the edge weights on this path is minimum.
+
+There are two sets of algorithms available: 
+(1) find shortest paths between a single vertex, say, {\em source s}, and 
+all other vertices, i.e., {\em V-s}, 
+available algorithms are: {\em Dijkstra's}, {\em Bellman Ford's} and {\em DAG},
+and 
+(2) find shortest paths between all pairs of vertices, available algorithms 
+are: {\em Johnson's} and {\em Floyd Warshall's}.
+
+%%FIXME: I think it would be helpful to first list the possibilities,
+%%maybe with a brief description of what they do, say in a table, then
+%%have more complete examples in the sections. Otherwise, it is hard
+%%for a reader to see what we have.
+
+{\em Dijkstra's algorithm } is for the single-source shortest-paths problem on
+graphs (directed or undirected) with non-negative weights on edges.
+If all the edges have the same weight, use depth-first-search instead.
+
+<<dijkdemo1>>=
+nodes(dijk)
+edgeWeights(dijk)
+dijkstra.sp(dijk)
+@
+
+The function \Rfunction{dijkstra.sp} finds the shortest paths from A,
+which is the first node in the node list - default source, 
+to all other vertices in the graph: {\em B, C, D, E}, shown in the
+{\em distances} part.  
+The {\em penult} shows TO-BE-FILLED-IN.
+
+For instance, edge {\em A->C} exists and carries a weight of 1, 
+so the shortest path from {\em A} to {\em C} is 1;
+the shortest path from {\em A} to {\em B} goes through 
+{\em A->C->D->E->B} and has weight of 6 (1+3+1+1).
+
+%%the use of penult is unfortunate. This is very hard for non-native
+%%speakers and should have been penultimate, if anything. But mostly
+%%it needs a good description of what it is and what it can be used
+%%for --- Vince?
+
+<<dijkdemo2>>=
+nodes(ospf)[6]
+dijkstra.sp(ospf,nodes(ospf)[6])
+sp.between(ospf, "RT6", "RT1")
+@
+
+The first part of this example finds the shortest paths from {\em start RT6}
+to all the other vertices in the graph, and the second part finds the shortest
+path between two vertices: {\em RT6} and {\em RT1}.  
+
+\begin{figure}
+@
+<<figospf, fig=TRUE, echo=false>>=
+z <- plot(ospf)
+@
+\caption{Network example from BGL.}
+\end{figure}
+
+{\em Bellman-Ford's algorithm} is for the single-source shortest-paths problem
+on graphs (directed or undirected) with both positive and negative
+edge weights.  The default source is the first entry in the list of nodes
+in the graph.   
+
+<<bellmanfordDemo>>=
+dd <- coex2
+nodes(dd)
+bellman.ford.sp(dd)
+bellman.ford.sp(dd,nodes(dd)[2])
+@
+
+The first \Rfunction{bellman.ford.sp} returns the shortest paths from 
+{\em start A}, which is the first vertex on the node list, 
+to all other vertices.  The second call shows the shortest paths from
+{\em start B} to all other vertices, since there is no path from {\em B} to
+{\em A}, the {\em distance} between them is \Robject{Inf}.
+
+
+The {\em DAG algorithm} is for the single-source shortest-paths problem on a
+weighted, directed acyclic graph (DAG), which is more efficient for DAG than
+both Dijkstra's and Bellman-Ford's algorithms.  When all the edges have the
+same weight, use depth-first-search instead.
+
+<<DAGDemo>>=
+dd <- coex2
+dag.sp(dd)
+dag.sp(dd,nodes(dd)[2])
+@
+
+It's easy to see that {\em conn2.gxl} doesn't contain any cycle, so we could
+use function \Rfunction{dag.sp} on it.  The first example finds the
+shortest paths from the {\em start A} to all other vertices.  The second example
+finds the shortest paths from {\em start B} to all other vertices, since no
+path goes from {\em B} to {\em A}, the distance is {\em Inf}.
+
+
+{\em Johnson's algorithm} finds the shortest path between every pair of
+vertices in a sparse graph.  Its time complexity is {\it O(V E log V)}.
+
+<<johnsonDemo>>=
+zz <- joh
+edgeWeights(zz)
+johnson.all.pairs.sp(zz)
+@
+\begin{figure}
+<<figjoh, fig=TRUE, echo=false>>=
+z <- plot(zz)
+@
+\caption{Example Johnson-all-pairs-shortest-paths example}
+\end{figure}
+
+This example uses a graph with negative edge weights.
+
+The shortest paths between all pairs of vertices are presented in the matrix,
+entry [i, j] gives the distance from vertex {\em i} to vertex {\em j}.
+For example, the shortest path from vertex {\em c} to vertex {\em d} is of
+length 5; the shortest path from vertex {\em a} to vertex {\em e} is of
+length -4, since edge {\em a->e} is available and of distance -4; the shortest
+distance from {\em a} to {\em c} is -3.
+
+
+{\em Floyd-Warshall's algorithm} finds the shortest path between every pair
+of vertices in a dense graph.
+
+<<floydwarshallDemo>>=
+floyd.warshall.all.pairs.sp(coex)
+@
+All edge distances are assumed to be 1, if not given.  Since the graph is
+undirected, the distance matrix is symmetric, for example, distance from
+{\em C} to {\em G} is the same as that from {\em G} to {\em C}.
+
+
+\subsection{Minimum spanning tree}
+
+Minimum-spanning-tree (MST) problem is to find a subset of edges that 
+connect all the vertices, contains no cycles and have the minimum weight sum.
+
+There are two algorithms available: {\em Kruskal's algorithm} and
+{\em Prim's algorithm}.  Both are for undirected graphs with weighted edges,
+and both return a list of edges, weights and nodes determining MST. 
+
+The \Rfunction{mstree.kruskal} function finds the MST 
+by Kruskal's algorithm.
+
+<<KMSTdemo>>=
+mstree.kruskal(km)
+@
+
+This graph is treated as undirected graph with corresponding weights.
+MST consists of 4 edges, {\em A->C, D->E, E->A, B->D}, each is of weight 1.
+
+The \Rfunction{mstree.prim} function finds the MST by Prim's algorithm.
+
+<<primDemo>>=
+mstree.prim(coex2)
+@
+
+The graph is treated as undirected graph with default weight 1.  MST consists
+of 7 edges, {\em A->B, A->C, A->D, C->E, D->H, E->F, C->G}.
+
+
+\subsection{Connected components }
+
+There are several algorithms available for this group of problems.
+
+A {\em connected component} of an undirected graph is a subgraph that for
+any two vertices in this subgraph, {\em u} and {\em v}, there's a path from
+{\em u} to {\em v}.
+
+The \Rfunction{connectedComp} function computes the connected components 
+in an undirected graph.
+
+<<conndemo>>=
+km1 <- km
+km1 <- graph::addNode(c("F","G","H"), km1)
+km1 <- addEdge("G", "H", km1, 1)
+km1 <- addEdge("H", "G", km1, 1)
+connectedComp(ugraph(km1))
+@
+
+<<figkm1, fig=TRUE, echo=false, results=hide, include=FALSE >>=
+plot(km1, main="Modified Kruskal MST example")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figkmst} &
+\includegraphics[width=0.49\textwidth]{RBGL-figkm1} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+Kruskal MST examples. }
+\end{figure}
+
+The original graph has one connected component. 
+After we add three vertices, {\em F, G, H} and an edge {\em G-H}, make the 
+graph {\em undirected}, the modified graph has three connected components now.
+
+A {\em strongly connected component} of a directed graph is a connected 
+subgraph that for every pair of vertices in this subgraph, {\em u} and {\em v},
+there are both a path from {\em u} to {\em v} and a path from {\em v} to 
+{\em u}.
+
+The \Rfunction{strongComp} function computes the strongly connected components 
+in a directed graph.
+
+<<sconndemo>>=
+km2 <- km
+km2 <- graph::addNode(c("F","G","H"), km2)
+km2 <- addEdge("G", "H", km2, 1)
+km2 <- addEdge("H", "G", km2, 1)
+strongComp(km2)
+@
+
+After adding three vertices, {\em F, G, H} and an edge {\em G-H},
+there are three strong components in the graph now.
+
+
+A {\em biconnected} graph is a connected graph that removal of any single vertex
+doesn't disconnect it.  If the removal of a vertex increases the number of
+components in a graph, this vertex is call an {\em articulation point}.
+
+The \Rfunction{biConnComp} function computes the biconnected components 
+in an undirected graph.
+The \Rfunction{articulationPoints} function finds all the articulation points 
+in an undirected graph.
+
+<<biConnCompdemo>>=
+biConnComp(bicoex)
+articulationPoints(bicoex)
+@
+
+\begin{figure}
+<<figbicoex, fig=TRUE, echo=false>>=
+z <- plot(bicoex)
+@
+\caption{Biconnected components example from Boost library.}
+\end{figure}
+
+There are 4 biconnected components in the example:
+one with vertices {\em B, C, D} and edges {\em B-C, C-D, B-D} labeled 0,
+one with vertices {\em A, B, E, F} and edges {\em A-B, B-E, E-F, A-F} labeled 1,
+one with vertices {\em G, H, I} and edges {\em G-I, G-H, I-H} labeled 2, and
+one with vertices {\em A, G} and edges {\em A-G} labeled 3.
+
+There are 3 articulation points in the example: {\em A, B, G}.  It's easy to 
+see removing any one of them will result in more connected components.
+
+When you {\em add} edges to an undirected graph and want to get updated 
+information on the connected components, you could use the following functions:
+\Rfunction{init.incremental.components} function to initialize the process;
+after adding edges to the graph, use \Rfunction{incremental.components} 
+function to update the information on the connected components; 
+use \Rfunction{same.component} function to find out
+if two vertices are in the same connected component.
+
+Currently, only one incremental graph is allowed at any given time.  To
+start on a new graph, you need to call \Rfunction{init.incremental.components}
+first.
+
+<<incrCompdemo>>=
+jcoex <- join(coex, hcs)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "F")
+same.component(jcoex, "A", "A1")
+jcoex <- addEdge("A", "A1", jcoex)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "A1")
+@
+
+\begin{figure}
+<<figjcoex, fig=TRUE, echo=false>>=
+z <- plot(jcoex)
+@
+\caption{Example on incremental components: a graph connecting coex and hcs.}
+\end{figure}
+
+In the first part of this example, we join two separate graphs together, 
+the resulting graph contains two connected components.  
+Vertices {\em A} and {\em F} are in the same connected component, while
+vertices {\em A} and {\em A1} are not in the same connected component.
+
+In the second part of the example, we add an edge connecting {\em A} and 
+{\em X}, which effectively connects the two subgraphs, we have only one 
+connected component left, which consists of all the vertices from the 
+two original graphs, {\em A} and {\em A1} are in the same connected component
+now.
+
+
+\subsection{Maximum Flow}
+
+The functions, \Rfunction{edmonds.karp.max.flow} and 
+\Rfunction{push.relabel.max.flow} are
+available to find the maximum flow between source and sink.
+
+<<MaxFlowdemo>>=
+edgeWeights(dijk)
+edmonds.karp.max.flow(dijk, "B", "D")
+push.relabel.max.flow(dijk, "C", "B")
+@
+
+Call to \Rfunction{edmonds.karp.max.flow} finds the maximum flow of 2 from 
+{\em B} to {\em D}: one part of flow 1 is {\em B -> D} directly, another
+part of flow 1 is {\em B -> E -> A -> C -> D}.
+
+Call to \Rfunction{push.relabel.max.flow} find the maximum flow of 8 from 
+{\em C} to {\em B}: one part of flow 7 is {\em C -> B} directly, another 
+part of flow 1 is {\em C -> D -> E -> B}.
+
+You can see the flow on each edge in the output, and each is no more than
+the capacity of the edge.
+
+\subsection{Sparse Matrix Ordering}
+
+There are three functions available in this category: 
+\Rfunction{cuthill.mckee.ordering}, \Rfunction{minDegreeOrdering} and
+\Rfunction{sloan.ordering}.
+
+{\em Cuthill-McKee's algorithm} tries to reduce the bandwidth of a graph by
+renumbering its vertices.  The outputs are the vertices in the new ordering
+and reverse ordering.
+
+{\em Minimum degree Ordering} is one approach that tries to reduce fill-ins
+in matrix reordering, which turns a system of equations {\em A x = b} to
+{\em (P A PT)(P x) = P b}.
+
+{\em Sloan Ordering} tries to reduce the profile and wavefront of a graph by
+renumbering its vertices.
+
+<<SparseMatrixOrderingdemo>>=
+dijk1 <- ugraph(dijk)
+cuthill.mckee.ordering(dijk1)
+minDegreeOrdering(dijk1)
+sloan.ordering(dijk1)
+@
+
+TODO: EXPLAIN THESE OUTPUT.
+
+
+\subsection{Edge connectivity and minimum disconnecting set}
+
+%%FIXME: I am a bit confused about the relationship between the stuff
+%%here, and the cutsets and betweenness centrality stuff? Is there
+%%anything that should be commented on?
+
+For a single connected undirected graph, function {\em edgeConnectivity}
+calculates the minimum number of edges that have to be removed to create
+two disconnected components.  No edge weight is taken into account and the 
+output is the edges that need to be removed.
+
+This is very similar to the {\em minCut} algorithm, which takes the edge 
+weights into account when removing edges and outputs the vertices on the 
+two disconnected components.
+
+<<edgeConndemo>>=
+edgeConnectivity(coex)
+@
+
+Mimimum of two edges must be removed to create two disconnected components:
+edges {\em D-E} and {\em D-H}.
+
+
+\subsection{Topological sort}
+
+The \Rfunction{tsort} function will return the names of vertices from a DAG
+in topological sort order.
+
+<<tsortDemo1>>=
+tsort(FileDep)
+@
+
+Note that if the input graph is not a DAG, BGL {\tt topological\_sort}
+will check this and throw 'not a dag'.  This is crudely captured
+in the interface (a message is written to the console and zeroes are returned).
+
+<<tsortDemo2>>=
+FD2 <- FileDep
+# now introduce a cycle
+FD2 <- addEdge(from="bar_o", to="dax_h", FD2)
+tsort(FD2)
+@
+
+%\subsection{Layout}
+%
+%If you want to simply draw a graph, you should consider using package 
+%{\em Rgraphviz}. 
+%
+%Package {\em Rgraphviz} provides a lot more functionalities in graph layout,
+%you can use it to do the actual layouts: 
+%a. "neato" uses Kamada-Kawai algorithm to make spring model layout, 
+%b. "fdp" uses Fruchterman-Reingold algorithm to make spring model layout,
+%c. "circo" does circular layout.
+%See Figure~\ref{fig:graphlayout} for an example.
+%
+%<<Layoutdemo>>=
+%# library(Rgraphviz)
+%plot(coex, "neato")
+%@
+%<<figneato, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%z <- plot(coex, "neato")
+%@
+%
+%The following functions are interfaces to those in BGL, they only calculate 
+%the (x, y)-coordinates of the vertices in the graph.  The actual layout is 
+%achieved with additional function, we provide an example on how to do so.
+%
+%Following functions are available:
+%
+%The \Rfunction{randomGraphLayout} function puts the vertices randomly 
+%on a plane;
+%
+%The \Rfunction{circleLayout} function puts the vertices as vertices of 
+%a regular polygon;
+%
+%The \Rfunction{kamadaKawaiSpringLayout} function is for connected, 
+%undirected graphs, it treats the edges as springs and tries to minimize 
+%the energy of the whole system;
+%
+%The \Rfunction{fruchtermanReingoldForceDirectedLayout} function is for 
+%unweighted, undirected, possibly disconnected graphs, it treats the edges 
+%as forces that pull vertices together, no-edges as forces that push 
+%vertices apart, vertices move to a position as environment changes; 
+%initial positions of the vertices are set randomly by calling 
+%\Rfunction{randomGraphLayout}.  Notice that the choice of "width" and 
+%"height" values has dramatic impact on the performance.
+%
+%<<Layoutdemo2>>=
+%randomGraphLayout(coex)
+%circleLayout(coex)
+%kamadaKawaiSpringLayout(coex)
+%fruchtermanReingoldForceDirectedLayout(coex, 10, 10)
+%@
+%
+%Outputs are the (x, y)-coordinates of the vertices in the layout.
+%
+%If you want to draw the graphs based on the calculated coordinates, you need 
+%an additional function.  The following is an example.
+%
+%<<Layoutdemo3>>=
+%crudeGraphPlot <- function(g, alg=circleLayout, ...) {
+%#
+%# the alg parameter is a function that computes the
+%# layout of g, returning it as a list of length 1
+%# with two rows: top row is x coordinates, bottom is
+%# y coordinates, and node names are used as colnames
+%# the ... are passed to segments()
+%#
+%  layout <- alg(g)
+%  plot( layout[1,], layout[2,], pch=nodes(g), axes=FALSE,
+%    xlab="", ylab="", main=substitute(g), cex=1.4 )
+%  ee <- edges(g)
+%  src <- names(ee)
+%  ds <- function(nn1, nn2, lob) segments(lob[1,nn1], lob[2,nn1],
+%        lob[1,nn2], lob[2,nn2], ...)
+%  for (s in src) sapply(ee[[s]], function(x) ds(s, x, layout))
+%  invisible(NULL)
+%}
+%
+%crudeGraphPlot(coex)
+%crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green")
+%@
+%
+%<<figlayout1, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%crudeGraphPlot(coex)
+%@
+%
+%<<figlayout2, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green")
+%@
+%
+%\begin{figure}[tp]
+%\begin{center}
+%\begin{tabular}{cc}
+%\includegraphics[width=0.49\textwidth]{RBGL-figneato} &
+%\includegraphics[width=0.49\textwidth]{RBGL-figlayout1} \\
+%\includegraphics[width=0.49\textwidth]{RBGL-figlayout2} \\
+%\end{tabular}
+%\end{center}
+%\caption{\label{fig:graphlayout}%
+%a) plot(coex, neato).
+%b) crudeGraphPlot(coex).
+%c) crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green"). }
+%\end{figure}
+%
+%Call crudeGraphPlot(coex) gives the default circular layout on your graphics device.
+%
+%Call crudeGraphPlot(coex, alg=kamada.kawai.spring.layout, col="green") shows you the spring layout with green edges, see Figure~\ref{fig:graphlayout}.
+%
+%
+\subsection{Isomorphism}
+
+The \Rfunction{isomorphism} function determines if two graphs are isomorphism, 
+i.e., determines if there is a one-to-one mapping {\em f} of vertices from 
+one graph {\em g1} to the other {\em g2} such that edge {\em u -> v} is in
+{\em E(g1)} iff edge {\em f(u) -> f(v)} exists and is in {\em E(g2)}.
+
+<<Isomorphismdemo>>=
+isomorphism(dijk, coex2)
+isomorphism(coex2i, coex2)
+@
+\begin{figure}
+<<figcoex2i, fig=TRUE, echo=false>>=
+z <- plot(coex2i)
+@
+\caption{Example conn2i}
+\end{figure}
+
+The function handles both directed and undirected graphs. 
+There are more vertices in graph {\em conn2} than {\em dijkstra}, so
+it's impossible to find a one-to-one mapping between them.
+One the other hand, graph {\em conn2i} is basically the same graph as 
+{\em conn2} except the vertices have different names, so they are isomorphism.
+
+
+\subsection{Vertex Coloring}
+
+The \Rfunction{sequential.vertex.coloring} function assigns colors, 
+as numbers 0, 1, 2, ..., to vertices in a graph
+so that two vertices connected by an edge are of different colors.  It does not
+guarantee that minimum number of colors is used, and the result depends on the
+input ordering of the vertices in the graph.
+
+<<VertexColoringdemo>>=
+sequential.vertex.coloring(coex)
+@
+
+We need 4 colors for the vertices of this graph, one color scheme is to give
+color 0 to vertices {\em A, E}, color 1 to vertices {\em B, H},
+color 2 to vertices {\em C, F} and color 3 to vertices {\em D, G}.
+
+
+%\subsection{Transitive Closure}
+%
+%Directed graphs can be used to represent relations, $R$, on a finite set
+%of objects, V. For example, the objects could be integers and the
+%relation could be less than. An edge exists in the graph, between two
+%nodes, $(u,v)$ if the $(u,v) \in R$. A \textit{transitive digraph} is
+%a digraph whose corresponding relation is transitive. That is, if
+%there is an edge $(u, v)$ and an edge $(v, w)$, then there must be an
+%edge $(u, w)$. Finally, the transitive closure, $R^*$ of an arbitrary
+%relation $R$ is the smallest transitive relation that contains $R$.
+%
+%Finally, if $D$ is the directed graph that represents the relation
+%$R$, then the directed graph $D^*$ that represents the relation $R^*$
+%is called the transitive closure of $D$.
+%
+%The function \Rfunction{transitive.closure} returns the transitive
+%closure of a directed graph.
+%
+%In the code below we compute the transitive closure for the example
+%graph \Robject{dijk} and then plot both the original graph, and the
+%transitive closure in Figure~\ref{fig:graphTC}.
+%
+%%%FIXME: surely this should return a graph of the same class as the
+%%%input, not some list? Not sure this is the most elegant, but it
+%%%seems to work - someone should check that the output is actually the
+%%%transitive closure - I do not much like the self-loops, but maybe
+%%%they are part of it.
+%
+%TO-BE-FINALIZED:
+%The transitive closure {\em tc} of a graph {\em g} is a graph that 
+%contains the same set of vertices as {\em g}, and there is an edge from 
+%{\em u} to {\em v} in {\em tc} iff there is a path from {\em u} to {\em v}
+%in {\em g}.
+%
+%<<transClosuredemo>>=
+%dijk.tc = transitive.closure(dijk)
+%@
+%
+%<<figdijkTC, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+%  plot(dijk.tc, main="b) Transitive closure")
+%@
+%
+%\begin{figure}[tp]
+%\begin{center}
+%\begin{tabular}{cc}
+%\includegraphics[width=0.49\textwidth]{RBGL-figdijk} &
+%\includegraphics[width=0.49\textwidth]{RBGL-figdijkTC} \\
+%\end{tabular}
+%\end{center}
+%\caption{\label{fig:graphTC}%
+%a) The graph for Dijkstra's example.
+%b) The transitive closure of the graph in panel a)}
+%\end{figure}
+%
+%In this graph, you can reach each and every vertex from any vertex.
+%
+
+\subsection{Wavefront, Profiles}
+
+TODO: EXPLAIN THESE TERMS
+
+The following functions are available: 
+\Rfunction{ith.wavefront}, \Rfunction{maxWavefront}, 
+\Rfunction{aver.wavefront} and \Rfunction{rms.wavefront}.
+
+<<wavefrontdemo>>=
+ss <- 1
+ith.wavefront(dijk, ss)
+maxWavefront(dijk)
+aver.wavefront(dijk)
+rms.wavefront(dijk)
+@
+
+TODO: EXPLAIN THESE RESULTS
+
+
+\subsection{Betweenness Centrality and Clustering}
+
+{\em Betweenness centrality} of a vertex (or an edge) measures its importance
+in a graph, i.e., among all the shortest paths between every pair of vertices
+in the graph, how many of them have to go through this vertex (or edge).
+{\em Relative} betweenness centrality is calculated by scaling the 
+{\em absolute} betweenness centrality by factor {\em 2/((n-1)(n-2))},
+where {\em n} is the number of vertices in the graph.
+
+The \Rfunction{brandes.betweenness.centrality} function implements 
+Brandes' algorithm in calculating betweenness centrality.
+
+The \Rfunction{betweenness.centrality.clustering} function implements 
+clustering in a graph based on edge betweenness centrality.
+
+TODO: EXPLAIN MORE
+
+<<Centralitydemo>>=
+brandes.betweenness.centrality(coex)
+betweenness.centrality.clustering(coex, 0.1, TRUE)
+@
+
+TODO: EXPLAIN THE RESULTS
+
+
+\section{Algorithms built on RBGL}
+
+\subsection{Min-Cut}
+
+Given an undirected graph G=(V, E) of a single connected
+component, a {\em cut} is  a partition of the set of vertices into two
+non-empty subsets S and V-S, a {\em cost} is the weight sum of edges that
+are incident on one vertex in S and one vertex in V-S.  The
+min-cut problem is to find a cut (S, V-S) of minimum cost.
+
+For simplicity, subset {\em S} is the smaller of the two.
+
+<<mincutdemo>>=
+minCut(coex)
+@
+
+Currently all edge weights are assumed to be 1, minimum cut is of weight 2, 
+it will partition the graph into two subsets: subset {\em A, B, C, D} and 
+subset {\em E, H, F, G}.
+
+
+\subsection{highlyConnSG}
+
+A graph {\em G} with {\em n} vertices is highly connected if its connectivity
+{\em k(G) > n/2}.  Function {\em highlyConnSG} partitions a graph into a set
+of highly connected subgraphs, by using minimum-cut algorithm repeatedly.
+To improve performance, it takes special care of singletons, low degree
+vertices and merges clusters.
+
+<<highlyConnSGdemo>>=
+highlyConnSG(coex)
+highlyConnSG(hcs)
+@
+
+In graph {\em conn}, two highly-connected-subgraphs are found: subgraph
+with vertices {\em A, B, C, D} and subgraph with vertices {\em E, H, F, G}.
+
+In graph {\em hcs}, 3 highly-connected-subgraphs are found: subgraph
+with vertices {\em A1, A2, A3, A4, A5}, subgraph with vertices 
+{\em B1, B2, B3, B4} and subgraph with vertices {\em X, Y, Z}.
+
+
+\section{Algorithms independent from RBGL}
+\subsection{maxClique}
+
+A {\em clique} is a complete subgraph, i.e., there is an edge between 
+every pair of vertices.
+
+{\em Maximum Clique} problem is to find the largest clique in a graph.  
+This problem is NP-complete, which means it cannot be solved by any known
+polynomial algorithm.
+
+Function {\em maxClique} implements the algorithm from {\em Finding all 
+cliques of an undirected graph}, by C. Bron and J. Kerbosch (CACM, Sept 1973,
+Vol 16, No. 9.), which finds all the cliques in a graph.
+
+<<MaxCliquedemo>>=
+maxClique(coex)
+maxClique(hcs)
+@
+
+In graph {\em conn}, 3 cliques are found:
+clique with vertices {\em D, B, C, A},
+clique with vertices {\em D, E, H} and
+clique with vertices {\em F, E, H, H}.
+
+In graph {\em hcs}, 10 cliques are found.  For instance, vertices 
+{\em A2, A4, A3} form a clique, vertices {\em B1, Y} form a clique.
+
+
+\subsection{is.triangulated}
+
+A graph is {\em triangulated} if all cycles of length 4 or more have a chord.
+The \Rfunction{is.triangulated} function returns TRUE or FALSE, accordingly.
+
+We implemented the following algorithm from {\em Combinatorial Optimization: algorithms and complexity} (p. 403) by C. H. Papadimitriou, K. Steiglitz:
+G is chordal iff either G is an empty graph, or there is a {\em v} in {\em V}
+such that (i) the neighborhood of {\em v}, i.e., {\em v} and its adjacent vertices, forms a clique, and (ii) recursively, {\em G-v} is chordal.
+
+<<IsTriangulateddemo>>=
+is.triangulated(coex)
+is.triangulated(hcs)
+@
+
+\subsection{separates}
+
+Function {\em separates} determines if a subset of vertices separates two other
+subsets of vertices, and returns TRUE or FALSE, accordingly.
+
+<<Separatesdemo>>=
+separates("B", "A", "E", km)
+separates("B", "A", "C", km)
+@
+
+\subsection{kCores}
+A {\em k-core} in a graph is a subgraph where each vertex is adjacent to 
+at least {\tt k} other vertices in the same subgraph.
+
+Function {\em kCores} finds all the k-cores in a graph.  It returns the core 
+numbers for all the nodes in the graph.  When the given graph is directed, 
+you can choose whether in-degree, out-degree or both should be considered.
+
+The k-core of a graph is not a necessarily connected subgraph.  If i > j, 
+the i-core of a graph contains the j-core of the same graph. 
+
+The implementation is based on the algorithm by V. Batagelj and M. Zaversnik, 2002.
+
+<<kCoresdemo1>>=
+kCores(kcoex)
+kcoex2 <- coex2
+kCores(kcoex2)
+kCores(kcoex2, "in")
+kCores(kcoex2, "out")
+g1 <- addEdge("C", "B", kcoex2)
+kCores(g1, "in")
+g2 <- addEdge("C", "A", kcoex2)
+kCores(g2, "out")
+@
+\begin{figure}
+<<figkcores, fig=TRUE, echo=false>>=
+z <- plot(kcoex)
+@
+\caption{K-cores Example.}
+\label{fdkcore}
+\end{figure}
+
+The example on directed graph, "conn2", turns out to be a waterfall-like graph.
+If we order the nodes as: A, B, C, D, E, F, H, G, all the edges go in the same
+direction, i.e., i -> j, i < j.
+
+Let's consider in-degree-only case: A has no in-edge so it is 0-core; after you
+eliminate A, no in-edge to B, so B is 0-core; continue this, we could see that
+there's no subset of nodes that each and every single node has 1 in-degree.
+Therefore, they are all of 0-core.
+
+For out-degree-only case: G has no out-edge, so it's 0-core; after eliminating
+G, F has no out-edge, so F is 0-core; continue this process, we could see that
+there's no subset of nodes that each and every single node has 1 out-edge.
+Therefore, they are all of 0-core.
+
+If we add edge(s) to break the waterfall-like property, {\em C->B}, {\em C->A}, 
+separately, we could see the changes in the core numbers that are consistant 
+with the analysis above.
+
+
+\subsection{kCliques}
+
+In social network analysis, a k-cliques is a maximum subgraph that the shortest distance between any two nodes is no more than k.
+
+Function {\em kCliques} finds all the k-cliques in an undirected graph (k = 1, ..., N, where N is the length of the longest shortest-path).  It returns all the k-cliques.
+
+Let D be a matrix, D[i][j] is the shortest path from node i to node j.  
+Algorithm is outlined as following.
+o. use Johnson's algorithm to fill D; let N = max(D[i][j]) for all i, j;
+o. each edge is a 1-clique by itself;
+o. for k = 2, ..., N, try to expand each (k-1)-clique to k-clique:
+    o. consider a (k-1)-clique the current k-clique KC;
+    o. repeat the following:
+          if for all nodes j in KC, D[v][j] <= k, add node v to KC;
+    o. eliminate duplicates;
+o. the whole graph is N-clique.
+
+<<kCliquesdemo>>=
+kCliques(kclex)
+@
+\begin{figure}
+<<figkcliques, fig=TRUE, echo=false>>=
+z <- plot(kclex)
+@
+\caption{K-cliques Example.}
+\label{fdkcliques}
+\end{figure}
+
+
+\end{document}
+
+
diff --git a/inst/doc/RBGL.pdf b/inst/doc/RBGL.pdf
new file mode 100644
index 0000000..004db5d
Binary files /dev/null and b/inst/doc/RBGL.pdf differ
diff --git a/inst/dot/cc-internet.dot b/inst/dot/cc-internet.dot
new file mode 100755
index 0000000..a49fda7
--- /dev/null
+++ b/inst/dot/cc-internet.dot
@@ -0,0 +1,67 @@
+graph G {
+rankdir="LR";
+size="5.625,7.75";
+ratio="fill";
+subgraph cluster0 {
+color="white"
+"engr-fe21.gw.nd.edu"
+"radole.lcs.mit.edu"
+"shub-e27.gw.nd.edu"
+"ihtfp.mit.edu"
+"core1-ord1-oc48.ord2.above.net"
+"albnxg1.ip.tele.dk"
+}
+subgraph cluster1 {
+color="white"
+"nycmny1-cr1.bbnplanet.net"
+"ccn-nerif35.Berkeley.EDU"
+"rip.Berkeley.EDU"
+"chicago1-nbr1.bbnplanet.net"
+"ccngw-ner-cc.Berkeley.EDU"
+"above-bbn-45Mbps.ord.above.net"
+}
+subgraph cluster2 {
+color="white"
+"gw-dkuug.oeb.tdk.ne"
+"vabi1-gige-1-1.google.com"
+}
+subgraph cluster3 {
+color="white"
+"boston1-br1.bbnplanet.net"
+"cambridge1-nbr2.bbnplanet.net"
+"helios.ee.lbl.gov"
+"lilac-dmc.Berkeley.EDU"
+"teledk.bbnplanet.net"
+"albnxg1.ip.tele.dk"
+}
+
+edge[style="bold"];
+
+"engr-fe21.gw.nd.edu" -- "shub-e27.gw.nd.edu"
+"shub-e27.gw.nd.edu" -- "chicago1-nbr1.bbnplanet.net"
+"shub-e27.gw.nd.edu" -- "core1-ord1-oc48.ord2.above.net"
+"chicago1-nbr1.bbnplanet.net" -- "above-bbn-45Mbps.ord.above.net"
+"above-bbn-45Mbps.ord.above.net" -- "engr-fe21.gw.nd.edu"
+"above-bbn-45Mbps.ord.above.net" -- "core1-ord1-oc48.ord2.above.net"
+"core1-ord1-oc48.ord2.above.net" -- "vabi1-gige-1-1.google.com"
+"vabi1-gige-1-1.google.com" -- "chicago1-nbr1.bbnplanet.net"
+
+"cambridge1-nbr2.bbnplanet.net" -- "boston1-br1.bbnplanet.net"
+"ihtfp.mit.edu" -- "boston1-br1.bbnplanet.net"
+"cambridge1-nbr2.bbnplanet.net" -- "radole.lcs.mit.edu"
+"ihtfp.mit.edu" -- "radole.lcs.mit.edu"
+
+"helios.ee.lbl.gov" -- "lilac-dmc.Berkeley.EDU"
+"lilac-dmc.Berkeley.EDU" -- "ccngw-ner-cc.Berkeley.EDU"
+"ccngw-ner-cc.Berkeley.EDU" -- "ccn-nerif35.Berkeley.EDU"
+"ccn-nerif35.Berkeley.EDU" -- "rip.Berkeley.EDU"
+"helios.ee.lbl.gov" -- "ccn-nerif35.Berkeley.EDU"
+"lilac-dmc.Berkeley.EDU" -- "rip.Berkeley.EDU"
+
+"nycmny1-cr1.bbnplanet.net" -- "teledk.bbnplanet.net"
+"teledk.bbnplanet.net" -- "albnxg1.ip.tele.dk"
+"albnxg1.ip.tele.dk" -- "gw-dkuug.oeb.tdk.ne"
+"nycmny1-cr1.bbnplanet.net" -- "gw-dkuug.oeb.tdk.ne"
+"nycmny1-cr1.bbnplanet.net" -- "albnxg1.ip.tele.dk"
+
+}
diff --git a/inst/dot/dfs-example.dot b/inst/dot/dfs-example.dot
new file mode 100755
index 0000000..06e2663
--- /dev/null
+++ b/inst/dot/dfs-example.dot
@@ -0,0 +1,28 @@
+graph G {
+  size="3,3"
+  ratio="fill"
+  node[shape="circle"]
+  edge[style="bold"]
+  a;
+  b;
+  c;
+  d;
+  e;
+  f;
+  g;
+  h;
+  i;
+  j;
+
+  c -- a[label="1"]
+  a -- b[color="gray",style="bold",weight=0]
+  f -- c[label="2"]
+  g -- f[label="3"]
+  f -- h[label="7"]
+  g -- d[label="4"]
+  b -- e[label="6"]
+  b -- d[label="5"]
+  e -- d[color="gray",style="bold",weight=0]
+
+  i -- j[label="8"]
+}
diff --git a/inst/dot/edge-connectivity.dot b/inst/dot/edge-connectivity.dot
new file mode 100755
index 0000000..f9dbada
--- /dev/null
+++ b/inst/dot/edge-connectivity.dot
@@ -0,0 +1,21 @@
+graph G {
+  rankdir="LR"
+  size="5,3"
+  ratio="fill"
+  node[shape="circle"]
+  A B C D E F G H
+  A -- B
+  A -- C
+  A -- D
+  B -- C
+  B -- D
+  C -- D
+  D -- E
+  D -- H
+  E -- F
+  E -- G
+  E -- H
+  F -- G
+  F -- H
+  G -- H
+}
diff --git a/inst/dot/joh.dot b/inst/dot/joh.dot
new file mode 100644
index 0000000..3d75387
--- /dev/null
+++ b/inst/dot/joh.dot
@@ -0,0 +1,12 @@
+digraph G {
+ a, b, c, d, e;
+ a -> b [weights=3];
+ a -> e [weights=-4];
+ a -> c [weights=8];
+ b -> d [weights=1];
+ b -> e [weights=7];
+ c -> b [weights=4];
+ d -> c [weights=-5];
+ d -> a [weights=2];
+ e -> d [weights=6];
+}
diff --git a/inst/dot/joh.gxl b/inst/dot/joh.gxl
new file mode 100644
index 0000000..f1f04f0
--- /dev/null
+++ b/inst/dot/joh.gxl
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="G" edgeids="true" edgemode="directed">
+		<node id="a">
+		</node>
+		<edge from="a" to="b" isdirected="true" id="a--b">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<edge from="a" to="e" isdirected="true" id="a--e">
+			<attr name="weight">
+				<int>-4</int>
+			</attr>
+		</edge>
+		<edge from="a" to="c" isdirected="true" id="a--c">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<node id="b">
+		</node>
+		<edge from="b" to="d" isdirected="true" id="b--d">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="b" to="e" isdirected="true" id="b--e">
+			<attr name="weight">
+				<int>7</int>
+			</attr>
+		</edge>
+		<node id="c">
+		</node>
+		<edge from="c" to="b" isdirected="true" id="c--b">
+			<attr name="weight">
+				<int>4</int>
+			</attr>
+		</edge>
+		<node id="d">
+		</node>
+		<edge from="d" to="c" isdirected="true" id="d--c">
+			<attr name="weight">
+				<int>-5</int>
+			</attr>
+		</edge>
+		<edge from="d" to="a" isdirected="true" id="d--a">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<node id="e">
+		</node>
+		<edge from="e" to="d" isdirected="true" id="e--d">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+	</graph>
+</gxl>
diff --git a/inst/dot/lkedge.Rnw b/inst/dot/lkedge.Rnw
new file mode 100644
index 0000000..8aa6635
--- /dev/null
+++ b/inst/dot/lkedge.Rnw
@@ -0,0 +1,80 @@
+
+
+%
+% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
+% likely to be overwritten.
+%
+\documentclass[12pt]{article}
+
+\usepackage{amsmath}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\bibliographystyle{plainnat} 
+ 
+\begin{document}
+%\setkeys{Gin}{width=0.55\textwidth}
+
+\section*{Issues with edge labeling in Rgraphviz}
+
+Here's a network diagram from the boost book
+
+\setkeys{Gin}{width=.83\textwidth}
+\includegraphics{ospf}
+@
+
+Note that there are many double edges with distinct
+weights depending on direction of edge.
+
+The dot file can be transformed to gxl by graphviz dot2gxl,
+and the gxl has to be edited (changing {\tt label} to {\tt weights})
+for a successful read by fromGXL.
+<<>>=
+library(graph)
+ospf <- fromGXL(file("ospf.gxl"))
+print(edgeWeights(ospf)[1:6])
+@
+It seems to me that this graph object has the right contents.
+
+
+The wlabs function will obtain a suitable edgeLabels argument
+for Rgraphviz::plot:
+<<>>=
+wlabs <- function (g) 
+{
+    ee <- edges(g)
+    ww <- edgeWeights(g)
+    ans <- ee
+    for (i in 1:length(ee)) {
+        ans[[i]] <- as.character(round(ww[[i]], 2))
+        names(ans[[i]]) <- ee[[i]]
+    }
+    ans
+}
+print(wlabs(ospf)[1:6])
+@
+The plot that we get from Rgraphviz shows the bidirectional
+edges as doubleheaded arrows and gives only one of the
+relevant weights.
+\setkeys{Gin}{width=.83\textwidth}
+<<fig=TRUE>>=
+library(Rgraphviz)
+plot(ospf,edgeLabels=wlabs(ospf))
+@
+
+It seems to me we may need to add an option to give
+rendering of separate edges for bidirectional connections,
+allowing separate edgelabels for such connections.  The
+graphNEL representation contains the necessary information.
+\end{document}
diff --git a/inst/dot/lkedge.pdf b/inst/dot/lkedge.pdf
new file mode 100644
index 0000000..9a269c9
Binary files /dev/null and b/inst/dot/lkedge.pdf differ
diff --git a/inst/dot/ospf-graph.dot b/inst/dot/ospf-graph.dot
new file mode 100755
index 0000000..d4fcee7
--- /dev/null
+++ b/inst/dot/ospf-graph.dot
@@ -0,0 +1,96 @@
+digraph G {
+  ratio="fill"
+  size="4,6"
+  edge[style="bold"]
+
+  RT1
+  RT2
+  RT3
+  RT4
+  RT5
+  RT6
+  RT7
+  RT8
+  RT9
+  RT10
+  RT11
+  RT12
+
+  N1
+  N2
+  N3
+  N4
+  N6
+  N7
+  N8
+  N9
+  N10
+  N11
+  N12
+  N13
+  N14
+  N15
+  H1
+
+  RT1 -> N1[label="3"]  
+  RT1 -> N3[label="1"]  
+
+  RT2 -> N2[label="3"]  
+  RT2 -> N3[label="1"]  
+
+  RT3 -> RT6[label="8"]
+  RT3 -> N3[label="1"]  
+  RT3 -> N4[label="2"]  
+
+  RT4 -> N3[label="1"]  
+  RT4 -> RT5[label="8"]
+
+  RT5 -> RT4[label="8"]
+  RT5 -> RT6[label="7"]
+  RT5 -> RT7[label="6"]
+  RT5 -> N12[label="8"]
+  RT5 -> N13[label="8"]
+  RT5 -> N14[label="8"]
+
+  RT6 -> RT3[label="6"]
+  RT6 -> RT5[label="6"]
+  RT6 -> RT10[label="7"]
+
+  RT7 -> RT5[label="6"]
+  RT7 -> N6[label="1"]  
+  RT7 -> N12[label="2"]
+  RT7 -> N15[label="9"]
+
+  RT8 -> N6[label="1"]  
+  RT8 -> N7[label="4"]  
+
+  RT9 -> N9[label="1"]  
+  RT9 -> N11[label="3"]
+
+  RT10 -> RT6[label="5"]
+  RT10 -> N6[label="1"]
+  RT10 -> N8[label="3"]
+
+  RT11 -> N8[label="2"]
+  RT11 -> N9[label="1"]
+
+  RT12 -> N9[label="1"]
+  RT12 -> N10[label="2"]
+  RT12 -> H1[label="10"]
+
+  N3 -> RT1[label="0"]
+  N3 -> RT2[label="0"]
+  N3 -> RT3[label="0"]
+  N3 -> RT4[label="0"]
+
+  N6 -> RT7[label="0"]
+  N6 -> RT8[label="0"]  
+  N6 -> RT10[label="0"]  
+
+  N8 -> RT10[label="0"]  
+  N8 -> RT11[label="0"]  
+
+  N9 -> RT9[label="0"]
+  N9 -> RT11[label="0"]  
+  N9 -> RT12[label="0"]  
+}
diff --git a/inst/dot/ospf.gxl b/inst/dot/ospf.gxl
new file mode 100644
index 0000000..89f5cb8
--- /dev/null
+++ b/inst/dot/ospf.gxl
@@ -0,0 +1,298 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<gxl>
+	<graph id="G" edgeids="true" edgemode="directed">
+		<attr name="ratio" kind="graph">
+			<string>fill</string>
+		</attr>
+		<attr name="size" kind="graph">
+			<string>4,6</string>
+		</attr>
+		<attr name="style" kind="edge">
+			<string>bold</string>
+		</attr>
+		<node id="RT1">
+		</node>
+		<edge from="RT1" to="N1" isdirected="true" id="RT1->N1">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<edge from="RT1" to="N3" isdirected="true" id="RT1->N3">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT2">
+		</node>
+		<edge from="RT2" to="N2" isdirected="true" id="RT2->N2">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<edge from="RT2" to="N3" isdirected="true" id="RT2->N3">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT3">
+		</node>
+		<edge from="RT3" to="RT6" isdirected="true" id="RT3->RT6">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge from="RT3" to="N3" isdirected="true" id="RT3->N3">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT3" to="N4" isdirected="true" id="RT3->N4">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<node id="RT4">
+		</node>
+		<edge from="RT4" to="N3" isdirected="true" id="RT4->N3">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT4" to="RT5" isdirected="true" id="RT4->RT5">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<node id="RT5">
+		</node>
+		<edge from="RT5" to="RT4" isdirected="true" id="RT5->RT4">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge from="RT5" to="RT6" isdirected="true" id="RT5->RT6">
+			<attr name="weight">
+				<int>7</int>
+			</attr>
+		</edge>
+		<edge from="RT5" to="RT7" isdirected="true" id="RT5->RT7">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge from="RT5" to="N12" isdirected="true" id="RT5->N12">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge from="RT5" to="N13" isdirected="true" id="RT5->N13">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<edge from="RT5" to="N14" isdirected="true" id="RT5->N14">
+			<attr name="weight">
+				<int>8</int>
+			</attr>
+		</edge>
+		<node id="RT6">
+		</node>
+		<edge from="RT6" to="RT3" isdirected="true" id="RT6->RT3">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge from="RT6" to="RT5" isdirected="true" id="RT6->RT5">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge from="RT6" to="RT10" isdirected="true" id="RT6->RT10">
+			<attr name="weight">
+				<int>7</int>
+			</attr>
+		</edge>
+		<node id="RT7">
+		</node>
+		<edge from="RT7" to="RT5" isdirected="true" id="RT7->RT5">
+			<attr name="weight">
+				<int>6</int>
+			</attr>
+		</edge>
+		<edge from="RT7" to="N6" isdirected="true" id="RT7->N6">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT7" to="N12" isdirected="true" id="RT7->N12">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge from="RT7" to="N15" isdirected="true" id="RT7->N15">
+			<attr name="weight">
+				<int>9</int>
+			</attr>
+		</edge>
+		<node id="RT8">
+		</node>
+		<edge from="RT8" to="N6" isdirected="true" id="RT8->N6">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT8" to="N7" isdirected="true" id="RT8->N7">
+			<attr name="weight">
+				<int>4</int>
+			</attr>
+		</edge>
+		<node id="RT9">
+		</node>
+		<edge from="RT9" to="N9" isdirected="true" id="RT9->N9">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT9" to="N11" isdirected="true" id="RT9->N11">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<node id="RT10">
+		</node>
+		<edge from="RT10" to="RT6" isdirected="true" id="RT10->RT6">
+			<attr name="weight">
+				<int>5</int>
+			</attr>
+		</edge>
+		<edge from="RT10" to="N6" isdirected="true" id="RT10->N6">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT10" to="N8" isdirected="true" id="RT10->N8">
+			<attr name="weight">
+				<int>3</int>
+			</attr>
+		</edge>
+		<node id="RT11">
+		</node>
+		<edge from="RT11" to="N8" isdirected="true" id="RT11->N8">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge from="RT11" to="N9" isdirected="true" id="RT11->N9">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<node id="RT12">
+		</node>
+		<edge from="RT12" to="N9" isdirected="true" id="RT12->N9">
+			<attr name="weight">
+				<int>1</int>
+			</attr>
+		</edge>
+		<edge from="RT12" to="N10" isdirected="true" id="RT12->N10">
+			<attr name="weight">
+				<int>2</int>
+			</attr>
+		</edge>
+		<edge from="RT12" to="H1" isdirected="true" id="RT12->H1">
+			<attr name="weight">
+				<int>10</int>
+			</attr>
+		</edge>
+		<node id="N1">
+		</node>
+		<node id="N2">
+		</node>
+		<node id="N3">
+		</node>
+		<edge from="N3" to="RT1" isdirected="true" id="N3->RT1">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N3" to="RT2" isdirected="true" id="N3->RT2">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N3" to="RT3" isdirected="true" id="N3->RT3">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N3" to="RT4" isdirected="true" id="N3->RT4">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N4">
+		</node>
+		<node id="N6">
+		</node>
+		<edge from="N6" to="RT7" isdirected="true" id="N6->RT7">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N6" to="RT8" isdirected="true" id="N6->RT8">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N6" to="RT10" isdirected="true" id="N6->RT10">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N7">
+		</node>
+		<node id="N8">
+		</node>
+		<edge from="N8" to="RT10" isdirected="true" id="N8->RT10">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N8" to="RT11" isdirected="true" id="N8->RT11">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N9">
+		</node>
+		<edge from="N9" to="RT9" isdirected="true" id="N9->RT9">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N9" to="RT11" isdirected="true" id="N9->RT11">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<edge from="N9" to="RT12" isdirected="true" id="N9->RT12">
+			<attr name="weight">
+				<int>0</int>
+			</attr>
+		</edge>
+		<node id="N10">
+		</node>
+		<node id="N11">
+		</node>
+		<node id="N12">
+		</node>
+		<node id="N13">
+		</node>
+		<node id="N14">
+		</node>
+		<node id="N15">
+		</node>
+		<node id="H1">
+		</node>
+	</graph>
+</gxl>
diff --git a/inst/dot/scc.dot b/inst/dot/scc.dot
new file mode 100755
index 0000000..66d0fc8
--- /dev/null
+++ b/inst/dot/scc.dot
@@ -0,0 +1,33 @@
+digraph SCC {
+ size="3,4"
+ ratio="fill"
+ edge[style="bold"]
+ "www.boost.org"
+ "www.yahoogroups.com"
+ "weather.yahoo.com"
+ "nytimes.com"
+ "www.boston.com"
+ "sourceforge.net"
+ "www.hp.com"
+ "anubis.dkuug.dk"
+ "www.lsc.nd.edu"
+ "www.lam-mpi.org"
+
+ "www.boost.org" -> "www.yahoogroups.com"
+ "www.boost.org" -> "sourceforge.net"
+ "www.boost.org" -> "anubis.dkuug.dk"
+ "www.yahoogroups.com" -> "weather.yahoo.com" 
+ "www.yahoogroups.com" -> "www.boost.org"
+ "weather.yahoo.com" -> "nytimes.com" 
+ "weather.yahoo.com" -> "www.yahoogroups.com"
+ "nytimes.com" -> "www.boston.com"
+ "www.boston.com" -> "nytimes.com"
+ "sourceforge.net" -> "www.hp.com"
+ "www.hp.com" -> "sourceforge.net"
+ "www.hp.com" -> "nytimes.com"
+ "anubis.dkuug.dk" -> "www.lsc.nd.edu"
+ "www.lsc.nd.edu" -> "anubis.dkuug.dk"
+ "www.lsc.nd.edu" -> "www.lam-mpi.org"
+ "www.lsc.nd.edu" -> "www.boston.com"
+ "www.lsc.nd.edu" -> "weather.yahoo.com"
+}
diff --git a/inst/dot/telephone-network.dot b/inst/dot/telephone-network.dot
new file mode 100755
index 0000000..4187d51
--- /dev/null
+++ b/inst/dot/telephone-network.dot
@@ -0,0 +1,42 @@
+graph G {
+  size="5,5.3"
+  ratio="fill"
+  edge[style="bold"]
+  Nobel
+  McKellar
+  "Parry Sound"
+  "Horseshoe Lake"
+  Rosseau
+  Mactier
+  "Bent River"
+  Dunchurch
+  Magnetawan
+  Kearny
+  "Glen Orchard"
+  Sprucedale
+  Novar
+  Huntsville
+  Bracebridge
+
+  Nobel -- McKellar[label="9", weight="9"]
+  Nobel -- "Parry Sound"[label="3", weight="3"]
+  McKellar -- Dunchurch[label="11", weight="11"]
+  Dunchurch -- Magnetawan[label="12", weight="12"]
+  McKellar -- Magnetawan[label="30", weight="30"]
+  Magnetawan -- Kearny[label="20", weight="20"]
+  Magnetawan -- Sprucedale[label="20", weight="20"]
+  Kearny -- Sprucedale[label="13", weight="13"]
+  Sprucedale -- Novar[label="18", weight="18"]
+  Sprucedale -- Huntsville[label="15", weight="15"]
+  Kearny -- Novar[label="8", weight="11"]
+  Novar -- Huntsville[label="5", weight="5"]
+  Huntsville -- Bracebridge[label="30", weight="30"]
+  Huntsville -- "Bent River"[label="30", weight="30"] 
+  Rosseau -- "Bent River"[label="8", weight="8"] 
+  Rosseau -- "Horseshoe Lake"[label="8", weight="8"] 
+  Mactier -- "Horseshoe Lake"[label="14", weight="14"] 
+  "Parry Sound" -- "Horseshoe Lake"[label="10", weight="10"] 
+  "Parry Sound" -- Dunchurch[label="20", weight="20"] 
+  Mactier -- "Glen Orchard"[label="9", weight="9"] 
+  "Glen Orchard" -- Bracebridge[label="15", weight="15"] 
+}
diff --git a/inst/fdep.ps b/inst/fdep.ps
new file mode 100644
index 0000000..89ca409
--- /dev/null
+++ b/inst/fdep.ps
@@ -0,0 +1,610 @@
+%!PS-Adobe-2.0
+%%Creator: dot version 1.8.5 (Sat Jun  1 01:08:38 EDT 2002)
+%%For: (root) root
+%%Title: G
+%%Pages: (atend)
+%%BoundingBox: 35 35 388 521
+%%EndComments
+save
+%%BeginProlog
+/DotDict 200 dict def
+DotDict begin
+
+/setupLatin1 {
+mark
+/EncodingVector 256 array def
+ EncodingVector 0
+
+ISOLatin1Encoding 0 255 getinterval putinterval
+
+EncodingVector
+  dup 306 /AE
+  dup 301 /Aacute
+  dup 302 /Acircumflex
+  dup 304 /Adieresis
+  dup 300 /Agrave
+  dup 305 /Aring
+  dup 303 /Atilde
+  dup 307 /Ccedilla
+  dup 311 /Eacute
+  dup 312 /Ecircumflex
+  dup 313 /Edieresis
+  dup 310 /Egrave
+  dup 315 /Iacute
+  dup 316 /Icircumflex
+  dup 317 /Idieresis
+  dup 314 /Igrave
+  dup 334 /Udieresis
+  dup 335 /Yacute
+  dup 376 /thorn
+  dup 337 /germandbls
+  dup 341 /aacute
+  dup 342 /acircumflex
+  dup 344 /adieresis
+  dup 346 /ae
+  dup 340 /agrave
+  dup 345 /aring
+  dup 347 /ccedilla
+  dup 351 /eacute
+  dup 352 /ecircumflex
+  dup 353 /edieresis
+  dup 350 /egrave
+  dup 355 /iacute
+  dup 356 /icircumflex
+  dup 357 /idieresis
+  dup 354 /igrave
+  dup 360 /dcroat
+  dup 361 /ntilde
+  dup 363 /oacute
+  dup 364 /ocircumflex
+  dup 366 /odieresis
+  dup 362 /ograve
+  dup 365 /otilde
+  dup 370 /oslash
+  dup 372 /uacute
+  dup 373 /ucircumflex
+  dup 374 /udieresis
+  dup 371 /ugrave
+  dup 375 /yacute
+  dup 377 /ydieresis  
+
+% Set up ISO Latin 1 character encoding
+/starnetISO {
+        dup dup findfont dup length dict begin
+        { 1 index /FID ne { def }{ pop pop } ifelse
+        } forall
+        /Encoding EncodingVector def
+        currentdict end definefont
+} def
+/Times-Roman starnetISO def
+/Times-Italic starnetISO def
+/Times-Bold starnetISO def
+/Times-BoldItalic starnetISO def
+/Helvetica starnetISO def
+/Helvetica-Oblique starnetISO def
+/Helvetica-Bold starnetISO def
+/Helvetica-BoldOblique starnetISO def
+/Courier starnetISO def
+/Courier-Oblique starnetISO def
+/Courier-Bold starnetISO def
+/Courier-BoldOblique starnetISO def
+cleartomark
+} bind def
+
+%%BeginResource: procset
+/coord-font-family /Times-Roman def
+/default-font-family /Times-Roman def
+/coordfont coord-font-family findfont 8 scalefont def
+
+/InvScaleFactor 1.0 def
+/set_scale {
+	dup 1 exch div /InvScaleFactor exch def
+	dup scale
+} bind def
+
+% styles
+/solid { } bind def
+/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
+/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
+/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
+/bold { 2 setlinewidth } bind def
+/filled { } bind def
+/unfilled { } bind def
+/rounded { } bind def
+/diagonals { } bind def
+
+% hooks for setting color 
+/nodecolor { sethsbcolor } bind def
+/edgecolor { sethsbcolor } bind def
+/graphcolor { sethsbcolor } bind def
+/nopcolor {pop pop pop} bind def
+
+/beginpage {	% i j npages
+	/npages exch def
+	/j exch def
+	/i exch def
+	/str 10 string def
+	npages 1 gt {
+		gsave
+			coordfont setfont
+			0 0 moveto
+			(\() show i str cvs show (,) show j str cvs show (\)) show
+		grestore
+	} if
+} bind def
+
+/set_font {
+	findfont exch
+	scalefont setfont
+} def
+
+% draw aligned label in bounding box aligned to current point
+/alignedtext {			% width adj text
+	/text exch def
+	/adj exch def
+	/width exch def
+	gsave
+		width 0 gt {
+			text stringwidth pop adj mul 0 rmoveto
+		} if
+		[] 0 setdash
+		text show
+	grestore
+} def
+
+/boxprim {				% xcorner ycorner xsize ysize
+		4 2 roll
+		moveto
+		2 copy
+		exch 0 rlineto
+		0 exch rlineto
+		pop neg 0 rlineto
+		closepath
+} bind def
+
+/ellipse_path {
+	/ry exch def
+	/rx exch def
+	/y exch def
+	/x exch def
+	matrix currentmatrix
+	newpath
+	x y translate
+	rx ry scale
+	0 0 1 0 360 arc
+	setmatrix
+} bind def
+
+/endpage { showpage } bind def
+
+/layercolorseq
+	[	% layer color sequence - darkest to lightest
+		[0 0 0]
+		[.2 .8 .8]
+		[.4 .8 .8]
+		[.6 .8 .8]
+		[.8 .8 .8]
+	]
+def
+
+/setlayer {/maxlayer exch def /curlayer exch def
+	layercolorseq curlayer get
+	aload pop sethsbcolor
+	/nodecolor {nopcolor} def
+	/edgecolor {nopcolor} def
+	/graphcolor {nopcolor} def
+} bind def
+
+/onlayer { curlayer ne {invis} if } def
+
+/onlayers {
+	/myupper exch def
+	/mylower exch def
+	curlayer mylower lt
+	curlayer myupper gt
+	or
+	{invis} if
+} def
+
+/curlayer 0 def
+
+%%EndResource
+%%EndProlog
+%%BeginSetup
+14 default-font-family set_font
+1 setmiterlimit
+% /arrowlength 10 def
+% /arrowwidth 5 def
+
+% make sure pdfmark is harmless for PS-interpreters other than Distiller
+/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
+% make '<<' and '>>' safe on PS Level 1 devices
+/languagelevel where {pop languagelevel}{1} ifelse
+2 lt {
+    userdict (<<) cvn ([) cvn load put
+    userdict (>>) cvn ([) cvn load put
+} if
+
+%%EndSetup
+%%Page: 1 1
+%%PageBoundingBox: 36 36 388 521
+%%PageOrientation: Portrait
+gsave
+35 35 353 486 boxprim clip newpath
+36 36 translate
+0 0 1 beginpage
+0 0 translate 0 rotate
+0.000 0.000 0.000 graphcolor
+14.00 /Times-Roman set_font
+
+%	dax_h
+gsave 10 dict begin
+123 458 33 18 ellipse_path
+stroke
+gsave 10 dict begin
+123 453 moveto 44 -0.5 (dax_h) alignedtext
+end grestore
+end grestore
+
+%	foo_cpp
+gsave 10 dict begin
+40 386 40 18 ellipse_path
+stroke
+gsave 10 dict begin
+40 381 moveto 58 -0.5 (foo_cpp) alignedtext
+end grestore
+end grestore
+
+%	dax_h -> foo_cpp
+newpath 105 443 moveto
+93 433 78 419 65 408 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 64 410 moveto
+58 402 lineto
+67 407 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	bar_cpp
+gsave 10 dict begin
+120 314 39 18 ellipse_path
+stroke
+gsave 10 dict begin
+120 309 moveto 57 -0.5 (bar_cpp) alignedtext
+end grestore
+end grestore
+
+%	dax_h -> bar_cpp
+newpath 123 440 moveto
+122 415 121 370 120 341 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 118 342 moveto
+120 332 lineto
+123 342 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	yow_h
+gsave 10 dict begin
+177 386 35 18 ellipse_path
+stroke
+gsave 10 dict begin
+177 381 moveto 49 -0.5 (yow_h) alignedtext
+end grestore
+end grestore
+
+%	dax_h -> yow_h
+newpath 136 441 moveto
+142 432 150 421 158 411 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 156 410 moveto
+164 403 lineto
+160 412 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	foo_o
+gsave 10 dict begin
+40 242 31 18 ellipse_path
+stroke
+gsave 10 dict begin
+40 237 moveto 41 -0.5 (foo_o) alignedtext
+end grestore
+end grestore
+
+%	foo_cpp -> foo_o
+newpath 40 368 moveto
+40 343 40 298 40 269 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 38 270 moveto
+40 260 lineto
+43 270 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	bar_o
+gsave 10 dict begin
+120 242 31 18 ellipse_path
+stroke
+gsave 10 dict begin
+120 237 moveto 40 -0.5 (bar_o) alignedtext
+end grestore
+end grestore
+
+%	bar_cpp -> bar_o
+newpath 120 296 moveto
+120 288 120 279 120 270 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 118 270 moveto
+120 260 lineto
+123 270 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	yow_h -> bar_cpp
+newpath 164 369 moveto
+157 360 148 349 140 339 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 138 341 moveto
+134 331 lineto
+142 337 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zag_cpp
+gsave 10 dict begin
+217 314 40 18 ellipse_path
+stroke
+gsave 10 dict begin
+217 309 moveto 58 -0.5 (zag_cpp) alignedtext
+end grestore
+end grestore
+
+%	yow_h -> zag_cpp
+newpath 187 369 moveto
+192 360 197 350 202 340 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 200 339 moveto
+207 332 lineto
+204 342 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zag_o
+gsave 10 dict begin
+219 170 31 18 ellipse_path
+stroke
+gsave 10 dict begin
+219 165 moveto 41 -0.5 (zag_o) alignedtext
+end grestore
+end grestore
+
+%	zag_cpp -> zag_o
+newpath 217 296 moveto
+218 271 218 226 219 197 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 217 198 moveto
+219 188 lineto
+222 198 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	boz_h
+gsave 10 dict begin
+262 386 32 18 ellipse_path
+stroke
+gsave 10 dict begin
+262 381 moveto 43 -0.5 (boz_h) alignedtext
+end grestore
+end grestore
+
+%	boz_h -> bar_cpp
+newpath 238 374 moveto
+215 362 181 345 155 331 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 155 334 moveto
+147 327 lineto
+157 329 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	boz_h -> zag_cpp
+newpath 251 369 moveto
+246 361 239 350 233 340 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 231 342 moveto
+228 332 lineto
+235 339 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zig_cpp
+gsave 10 dict begin
+313 314 38 18 ellipse_path
+stroke
+gsave 10 dict begin
+313 309 moveto 54 -0.5 (zig_cpp) alignedtext
+end grestore
+end grestore
+
+%	boz_h -> zig_cpp
+newpath 274 369 moveto
+280 360 288 349 295 340 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 293 339 moveto
+301 332 lineto
+297 341 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zig_o
+gsave 10 dict begin
+302 170 30 18 ellipse_path
+stroke
+gsave 10 dict begin
+302 165 moveto 38 -0.5 (zig_o) alignedtext
+end grestore
+end grestore
+
+%	zig_cpp -> zig_o
+newpath 312 296 moveto
+310 271 307 226 304 197 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 302 198 moveto
+303 188 lineto
+307 198 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zow_h
+gsave 10 dict begin
+38 458 34 18 ellipse_path
+stroke
+gsave 10 dict begin
+38 453 moveto 47 -0.5 (zow_h) alignedtext
+end grestore
+end grestore
+
+%	zow_h -> foo_cpp
+newpath 39 440 moveto
+39 432 39 423 39 414 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 37 414 moveto
+40 404 lineto
+41 414 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	libfoobar_a
+gsave 10 dict begin
+119 170 51 18 ellipse_path
+stroke
+gsave 10 dict begin
+119 165 moveto 81 -0.5 (libfoobar_a) alignedtext
+end grestore
+end grestore
+
+%	foo_o -> libfoobar_a
+newpath 57 227 moveto
+68 217 81 204 94 193 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 92 192 moveto
+101 187 lineto
+95 195 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	libzigzag_a
+gsave 10 dict begin
+219 98 50 18 ellipse_path
+stroke
+gsave 10 dict begin
+219 93 moveto 78 -0.5 (libzigzag_a) alignedtext
+end grestore
+end grestore
+
+%	libfoobar_a -> libzigzag_a
+newpath 142 154 moveto
+156 144 174 131 188 120 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 187 118 moveto
+196 114 lineto
+190 122 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	bar_o -> libfoobar_a
+newpath 120 224 moveto
+119 216 119 207 119 198 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 117 198 moveto
+119 188 lineto
+122 198 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	killerapp
+gsave 10 dict begin
+219 26 41 18 ellipse_path
+stroke
+gsave 10 dict begin
+219 21 moveto 60 -0.5 (killerapp) alignedtext
+end grestore
+end grestore
+
+%	libzigzag_a -> killerapp
+newpath 219 80 moveto
+219 72 219 63 219 54 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 217 54 moveto
+219 44 lineto
+222 54 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zig_o -> libzigzag_a
+newpath 285 155 moveto
+273 145 258 132 245 121 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 244 123 moveto
+238 115 lineto
+247 120 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+
+%	zag_o -> libzigzag_a
+newpath 219 152 moveto
+219 144 219 135 219 126 curveto
+stroke
+0.000 0.000 0.000 edgecolor
+newpath 217 126 moveto
+219 116 lineto
+222 126 lineto
+closepath
+fill
+0.000 0.000 0.000 edgecolor
+endpage
+grestore
+%%PageTrailer
+%%EndPage: 1
+%%Trailer
+%%Pages: 1
+end
+restore
+%%EOF
diff --git a/inst/unitTests/test_segfault.R b/inst/unitTests/test_segfault.R
new file mode 100644
index 0000000..e6854ae
--- /dev/null
+++ b/inst/unitTests/test_segfault.R
@@ -0,0 +1,24 @@
+
+# This tests that the segfault discovered in Mavericks and fixed
+# on 8/12/2014 does not recur.
+test_segfault <- function()
+{
+    args <- structure(list(arg1 = 14L, arg2 = 55L, arg3 = c(0L, 10L, 0L, 
+1L, 0L, 2L, 0L, 3L, 0L, 11L, 0L, 12L, 0L, 4L, 0L, 5L, 0L, 6L, 
+0L, 7L, 0L, 8L, 0L, 9L, 1L, 10L, 1L, 2L, 1L, 3L, 1L, 11L, 1L, 
+12L, 1L, 4L, 1L, 5L, 1L, 6L, 1L, 7L, 1L, 8L, 1L, 9L, 2L, 10L, 
+2L, 3L, 2L, 11L, 2L, 4L, 2L, 5L, 2L, 6L, 2L, 9L, 3L, 10L, 3L, 
+11L, 3L, 12L, 3L, 4L, 3L, 5L, 3L, 6L, 3L, 7L, 3L, 9L, 4L, 11L, 
+4L, 12L, 4L, 5L, 4L, 6L, 4L, 7L, 4L, 9L, 5L, 11L, 5L, 12L, 5L, 
+6L, 5L, 9L, 6L, 7L, 6L, 9L, 7L, 11L, 7L, 12L, 7L, 9L, 9L, 11L, 
+11L, 12L), arg4 = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
+1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 
+    arg5 = 3L, arg6 = 3L, arg7 = c(3L, 2L, 1L)), .Names = c("arg1", 
+"arg2", "arg3", "arg4", "arg5", "arg6", "arg7"))
+    with(args, {ans = .Call("BGL_highly_conn_sg",
+                arg1, arg2,
+                arg3, arg4,
+                arg5, arg6, arg7,
+                PACKAGE="RBGL")})
+}
\ No newline at end of file
diff --git a/man/FileDep.Rd b/man/FileDep.Rd
new file mode 100644
index 0000000..7cdeba7
--- /dev/null
+++ b/man/FileDep.Rd
@@ -0,0 +1,33 @@
+\name{FileDep}
+\alias{FileDep}
+\non_function{}
+\title{ FileDep: a graphNEL object representing a file dependency dataset
+example in boost graph library }
+
+\description{ FileDep: a graphNEL object representing a file dependency dataset
+example in boost graph library }
+
+\usage{#data(FileDep)}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\examples{
+# this is how the graph of data(FileDep) was obtained
+library(graph)
+fd <- file(system.file("XML/FileDep.gxl",package="RBGL"), open="r")
+show(fromGXL(fd))
+if (require(Rgraphviz))
+ {
+ data(FileDep)
+ plot(FileDep)
+ }
+close(fd)
+}
+\keyword{graphs}
diff --git a/man/RBGL.overview.Rd b/man/RBGL.overview.Rd
new file mode 100644
index 0000000..e2a49bd
--- /dev/null
+++ b/man/RBGL.overview.Rd
@@ -0,0 +1,121 @@
+\name{RBGL.overview}
+\alias{RBGL.overview}
+\title{RBGL.overview}
+
+\description{The RBGL package consists of a number of interfaces to the Boost
+C++ library for graph algorithms.  This page follows, approximately,
+the chapter structure of the monograph on the Boost Graph Library
+by Siek et al., and gives hyperlinks to documentation on
+R functions currently available, along with the names
+of formal parameters to these functions. }
+
+\section{ basicAlgs }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL]{bandwidth}} \tab \code{g}\cr
+\code{\link[RBGL]{bfs}} \tab \code{object,node,checkConn}\cr
+\code{\link[RBGL:bfs]{dfs}} \tab \code{object,node,checkConn}\cr
+\code{\link[RBGL:edgeConn]{edgeConnectivity}} \tab \code{g}\cr
+\code{\link[RBGL]{gprofile}} \tab \code{g}\cr
+\code{\link[RBGL]{isomorphism}} \tab \code{g1,g2}\cr
+\code{\link[RBGL]{minCut}} \tab \code{g}\cr
+\code{\link[RBGL:transClosure]{transitive.closure}} \tab \code{g}\cr
+\code{\link[RBGL]{tsort}} \tab \code{x}\cr
+}
+}
+
+\section{ ShortestPaths }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL]{bellman.ford.sp}} \tab \code{g,start}\cr
+\code{\link[RBGL]{dag.sp}} \tab \code{g,start}\cr
+\code{\link[RBGL]{dijkstra.sp}} \tab \code{g,start}\cr
+\code{\link[RBGL]{extractPath}} \tab \code{s,f,pens}\cr
+\code{\link[RBGL]{johnson.all.pairs.sp}} \tab \code{g}\cr
+\code{\link[RBGL]{sp.between}} \tab \code{g,start,finish}\cr
+\code{\link[RBGL:sp.between]{sp.between.old}} \tab \code{g,start,finish}\cr
+\code{\link[RBGL:sp.between]{sp.between.scalar}} \tab \code{g,start,finish}\cr
+}
+}
+\section{ MinimumSpanningTree }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL]{mstree.kruskal}} \tab \code{x}\cr
+}
+}
+\section{ ConnectedComponents }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL]{connectedComp}} \tab \code{g}\cr
+\code{\link[RBGL]{highlyConnSG}} \tab \code{g,sat,ldv}\cr
+\code{\link[RBGL:incrConnComp]{incremental.components}} \tab \code{g}\cr
+\code{\link[RBGL:incrConnComp]{init.incremental.components}} \tab \code{g}\cr
+\code{\link[RBGL:incrConnComp]{same.component}} \tab \code{g,node1,node2}\cr
+\code{\link[RBGL]{strongComp}} \tab \code{g}\cr
+}
+}
+\section{ MaximumFlow }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:maxFlow]{edmonds.karp.max.flow}} \tab \code{g,source,sink}\cr
+\code{\link[RBGL:maxFlow]{push.relabel.max.flow}} \tab \code{g,source,sink}\cr
+}
+}
+\section{ SparseMatrixOrdering }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:ordering]{cuthill.mckee.ordering}} \tab \code{g}\cr
+\code{\link[RBGL:ordering]{minDegreeOrdering}} \tab \code{g,delta}\cr
+\code{\link[RBGL:ordering]{sloan.ordering}} \tab \code{g,w1,w2}\cr
+}
+}
+\section{ LayoutAlgorithms }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:layout]{circle.layout}} \tab \code{g,radius}\cr
+\code{\link[RBGL:layout]{kamada.kawai.spring.layout}} \tab \code{g,edge_or_side,es_length}\cr
+}
+}
+\section{ GraphClustering }{
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:bccluster]{betweenness.centrality.clustering}} \tab \code{g,threshold,normalize}\cr
+}
+}
+
+\section{ Betweenness }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:betweenness]{brandes.betweenness.centrality}} \tab \code{g}\cr
+}
+}
+\section{ Wavefront }{
+
+\tabular{ll}{
+Functions \tab parameters \cr 
+\code{\link[RBGL:wavefront]{aver.wavefront}} \tab \code{g}\cr
+\code{\link[RBGL:wavefront]{ith.wavefront}} \tab \code{g,start}\cr
+\code{\link[RBGL:wavefront]{maxWavefront}} \tab \code{g}\cr
+\code{\link[RBGL:wavefront]{rms.wavefront}} \tab \code{g}\cr
+}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\keyword{models}
+
diff --git a/man/astarSearch.Rd b/man/astarSearch.Rd
new file mode 100644
index 0000000..9683bcf
--- /dev/null
+++ b/man/astarSearch.Rd
@@ -0,0 +1,35 @@
+\name{astarSearch}
+\alias{astarSearch}
+\title{Compute astarSearch for a graph}
+\description{Compute astarSearch for a graph}
+\usage{
+astarSearch(g)
+}
+\arguments{
+  \item{g}{an instance of the \code{graph} class} 
+}
+\details{
+NOT IMPLEMENTED YET.  TO BE FILLED IN
+}
+%\value{
+%}
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual; 
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine; 
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp. 
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+astarSearch(coex)
+}
+\keyword{ models }
diff --git a/man/bandwidth.Rd b/man/bandwidth.Rd
new file mode 100644
index 0000000..b88c119
--- /dev/null
+++ b/man/bandwidth.Rd
@@ -0,0 +1,45 @@
+\name{bandwidth}
+\alias{bandwidth}
+\title{Compute bandwidth for an undirected graph}
+\description{Compute bandwidth for an undirected graph}
+
+\usage{
+bandwidth(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+}
+
+\details{
+The bandwidth of an undirected graph G=(V, E) is the maximum distance between 
+two adjacent vertices. 
+See documentation on bandwidth in Boost Graph Library for more details.
+}
+
+\value{
+\item{bandwidth}{the bandwidth of the given graph}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{  }
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+coex <- ugraph(coex)
+bandwidth(coex)
+}
+\keyword{ models }
diff --git a/man/bccluster.Rd b/man/bccluster.Rd
new file mode 100644
index 0000000..6a57028
--- /dev/null
+++ b/man/bccluster.Rd
@@ -0,0 +1,58 @@
+\name{betweenness.centrality.clustering}
+\alias{betweenness.centrality.clustering}
+\title{Graph clustering based on edge betweenness centrality}
+\description{Graph clustering based on edge betweenness centrality}
+
+\usage{
+betweenness.centrality.clustering(g, threshold = -1, normalize = T)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+  \item{threshold}{threshold to terminate clustering process}
+  \item{normalize}{boolean, when TRUE, the  edge betweenness centrality is 
+     scaled by \code{2/((n-1)(n-2))} where \code{n} is the number of vertices 
+     in \code{g}; when FALSE, the edge betweenness centrality is the absolute
+     value}
+}
+
+\details{
+To implement graph clustering based on edge betweenness centrality.
+
+The algorithm is iterative, at each step it computes the edge betweenness
+centrality and removes the edge with maximum betweenness centrality when it
+is above the given \code{threshold}.  When the maximum betweenness centrality 
+falls below the threshold, the algorithm terminates.
+
+See documentation on Clustering algorithms in Boost Graph Library for details.
+}
+
+\value{
+A list of
+\item{no.of.edges}{number of remaining edges after removal}
+\item{edges}{remaining edges}
+\item{edge.betweenness.centrality}{betweenness centrality of remaining edges}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{brandes.betweenness.centrality}}} 
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+coex <- ugraph(coex)
+betweenness.centrality.clustering(coex, 0.5, TRUE)
+}
+\keyword{ models }
diff --git a/man/bellman.ford.sp.Rd b/man/bellman.ford.sp.Rd
new file mode 100644
index 0000000..5f136d1
--- /dev/null
+++ b/man/bellman.ford.sp.Rd
@@ -0,0 +1,62 @@
+\name{bellman.ford.sp}
+\alias{bellman.ford.sp}
+\title{ Bellman-Ford shortest paths using boost C++ }
+
+\description{
+Algorithm for the single-source shortest paths problem for a graph with both positive and negative edge weights. 
+}
+
+\usage{
+bellman.ford.sp(g,start=nodes(g)[1])
+}
+
+\arguments{
+  \item{g}{ instance of class graph }
+  \item{start}{ character: node name for start of path }
+}
+
+\details{
+This function interfaces to the Boost graph library C++
+routines for Bellman-Ford shortest paths.  
+Choose the appropriate algorithm to calculate the shortest path 
+carefully based on the properties of the given graph.
+See documentation on Bellman-Ford algorithm in Boost Graph Library 
+for more details.
+}
+
+\value{
+A list with elements:
+\item{all edges minimized}{true if all edges are minimized, false otherwise. }
+\item{distance}{The vector of distances from \code{start} to each node
+of \code{g}; includes \code{Inf} when there is no path from \code{start}.}
+\item{penult}{A vector of indices 
+(in \code{nodes(g)}) of predecessors corresponding to each node
+on the path from that node back to \code{start}}. For example, if the
+element one of this vector has value \code{10}, that means that the
+predecessor of node \code{1} is node \code{10}. The next predecessor is
+found by examining \code{penult[10]}.
+\item{start}{The start node that was supplied in the call to
+\code{bellman.ford.sp}.}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\seealso{\code{\link{dag.sp}}, \code{\link{dijkstra.sp}}, \code{\link{johnson.all.pairs.sp}}, \code{\link{sp.between}} }
+
+\examples{
+con <- file(system.file("XML/conn2.gxl",package="RBGL"), open="r")
+dd <- fromGXL(con)
+close(con)
+bellman.ford.sp(dd)
+bellman.ford.sp(dd,nodes(dd)[2])
+}
+\keyword{ graphs }
diff --git a/man/betweenness.Rd b/man/betweenness.Rd
new file mode 100644
index 0000000..f2447b6
--- /dev/null
+++ b/man/betweenness.Rd
@@ -0,0 +1,66 @@
+\name{brandes.betweenness.centrality}
+\alias{brandes.betweenness.centrality}
+\title{Compute betweenness centrality for an undirected graph}
+\description{Compute betweenness centrality for an undirected graph}
+
+\usage{
+brandes.betweenness.centrality(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+}
+
+\details{
+\code{Brandes.betweenness.centrality} computes the betweenness centrality of 
+each vertex or each edge in the graph, using an algorithm by U. Brandes.
+
+Betweenness centrality of a vertex \code{v} is calculated as follows:
+\code{N_st(v)} = no. of shortest paths from \code{s} to \code{t} that pass through \code{v},
+\code{N_st} = no. of shortest paths from \code{s} to \code{t},
+betweenness centrality of \code{v} = \code{sum(N_st(v)/N_st)} for all vertices \code{s} != \code{v} != \code{t}.
+
+Betweenness centrality of an edge is calculated similarly.
+
+The relative betweenness centrality for a vertex is to scale the betweenness
+centrality of the given vertex by \code{2/(n**2 - 3n + 2)} where \code{n} is 
+the no. of vertices in the graph.
+
+Central point dominance measures the maximum betweenness of any vertex 
+in the graph.
+
+See documentation on brandes betweenness centrality in Boost Graph Library 
+for more details.
+}
+
+\value{
+  A list of
+\item{betweenness.centrality.vertices}{betweenness centrality of each vertex}
+\item{betweenness.centrality.edges}{betweenness centrality of each edge}
+\item{relative.betweenness.centrality.vertices}{relative betweenness centrality of each vertex}
+\item{dominance}{maximum betweenness of any point in the graph}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{betweenness.centrality.clustering}}}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+coex <- ugraph(coex)
+brandes.betweenness.centrality(coex)
+}
+\keyword{ models }
+
diff --git a/man/bfs.Rd b/man/bfs.Rd
new file mode 100644
index 0000000..10a7d5d
--- /dev/null
+++ b/man/bfs.Rd
@@ -0,0 +1,89 @@
+\name{bfs}
+\alias{bfs}
+\alias{dfs}
+
+\alias{dfs,graph,character,ANY-method}
+
+\alias{bfs,graph,character,logical-method}
+\alias{dfs,graph,character,logical-method}
+
+\alias{bfs,graph,missing,logical-method}
+\alias{bfs,graph,character,missing-method}
+\alias{dfs,graph,character,missing-method}
+
+\alias{bfs,graph,missing,missing-method}
+\alias{dfs,graph,missing,missing-method}
+
+\alias{bfs,graph-method}
+
+\alias{bfs,graph,character-method}
+\alias{dfs,graph,character-method}
+
+\alias{bfs,graph,ANY,ANY-method}
+
+\title{ Breadth and Depth-first search }
+
+\description{
+  These functions return information on
+  graph traversal by breadth and depth first search using
+  routines from the BOOST library.  
+}
+
+\usage{
+bfs(object, node, checkConn=TRUE)
+dfs(object, node, checkConn=TRUE)
+}
+
+\arguments{
+  \item{object}{ instance of class graph from Bioconductor graph class}
+  \item{node}{ node name where search starts; defaults to the
+node in first position in the node vector.}
+  \item{checkConn}{ logical for backwards compatibility; this
+parameter has no effect as of RBGL 1.7.9 and will be removed in future versions.}
+}
+
+\details{
+  These two functions are interfaces to the BOOST graph library functions for 
+  breadth first and depth first search. Both methods handle unconnected graphs 
+  by applying the algorithms over the connected components. 
+
+  Cormen et al note (p 542) that `results of depth-first search
+  may depend upon the order in which the vertices are examined ...
+  These different visitation orders tend not to cause problems
+  in practice, as any DFS result can usually be used effectively,
+  with essentially equivalent results'.  
+}
+
+\value{
+For \code{bfs} a vector of node indices in order of BFS visit.
+
+For \code{dfs} a list of two vectors of nodes, with elements \code{discover} 
+(order of DFS discovery), and \code{finish} (order of DFS completion).
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ VJ Carey <stvjc at channing.harvard.edu> }
+
+\examples{
+con1 <- file(system.file("XML/bfsex.gxl",package="RBGL"), open="r")
+dd <- fromGXL(con1)
+close(con1)
+
+bfs(dd, "r")
+bfs(dd, "s")
+
+con2 <- file(system.file("XML/dfsex.gxl",package="RBGL"), open="r")
+dd2 <- fromGXL(con2)
+close(con2)
+
+dfs(dd2, "u")
+}
+\keyword{ graphs }
diff --git a/man/biConnComp.Rd b/man/biConnComp.Rd
new file mode 100644
index 0000000..6b24d0a
--- /dev/null
+++ b/man/biConnComp.Rd
@@ -0,0 +1,62 @@
+\name{biConnComp}
+\alias{biConnComp}
+\alias{articulationPoints}
+\title{Compute biconnected components for a graph}
+\description{Compute biconnected components for a graph}
+
+\usage{
+biConnComp(g)
+articulationPoints(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class} 
+}
+
+\details{
+
+A biconnected graph is a connected graph that remains connected when 
+any one of its vertices, and all the edges incident on this vertex,
+is removed and the graph remains connected.
+A biconnected component of a graph is a subgraph which is biconnected.  An 
+integer label is assigned to each edge to indicate which biconnected component 
+it's in.
+
+A vertex in a graph is called an articulation point if removing it increases 
+the number of connected components.
+
+See the documentation for the Boost Graph Library for more details.
+}
+
+\value{
+For \code{biConnComp}:
+a vector whose length is no. of biconnected components, each entry is a list 
+of nodes that are on the same biconnected components.
+
+For \code{articulationPoints}:
+a vector of articulation points in the graph.
+
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+biConnComp(coex)
+articulationPoints(coex)
+}
+\keyword{ models }
diff --git a/man/boyerMyrvoldPlanarityTest.Rd b/man/boyerMyrvoldPlanarityTest.Rd
new file mode 100644
index 0000000..827b129
--- /dev/null
+++ b/man/boyerMyrvoldPlanarityTest.Rd
@@ -0,0 +1,37 @@
+\name{boyerMyrvoldPlanarityTest}
+\alias{boyerMyrvoldPlanarityTest}
+
+\title{boyerMyrvoldPlanarityTest}
+
+\description{boyerMyrvoldPlanarityTest description }
+
+\usage{
+boyerMyrvoldPlanarityTest(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+%\examples{
+% }
+
+\keyword{ graphs }
+
diff --git a/man/chrobakPayneStraightLineDrawing.Rd b/man/chrobakPayneStraightLineDrawing.Rd
new file mode 100644
index 0000000..fa5996a
--- /dev/null
+++ b/man/chrobakPayneStraightLineDrawing.Rd
@@ -0,0 +1,58 @@
+\name{chrobakPayneStraightLineDrawing}
+\alias{chrobakPayneStraightLineDrawing}
+
+\title{chrobakPayneStraightLineDrawing}
+
+\description{chrobakPayneStraightLineDrawing description }
+
+\usage{
+chrobakPayneStraightLineDrawing(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+V <- LETTERS[1:7]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+1], V[2+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[0+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+g <- addEdge(V[1+5], V[6+1], g)
+g <- addEdge(V[1+6], V[3+1], g)
+g <- addEdge(V[1+0], V[4+1], g)
+g <- addEdge(V[1+1], V[3+1], g)
+g <- addEdge(V[1+3], V[5+1], g)
+g <- addEdge(V[1+2], V[6+1], g)
+g <- addEdge(V[1+1], V[4+1], g)
+g <- addEdge(V[1+1], V[5+1], g)
+g <- addEdge(V[1+1], V[6+1], g)
+
+x3 <- chrobakPayneStraightLineDrawing(g)
+x3
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/clusteringCoef.Rd b/man/clusteringCoef.Rd
new file mode 100644
index 0000000..0710f0b
--- /dev/null
+++ b/man/clusteringCoef.Rd
@@ -0,0 +1,56 @@
+\name{clusteringCoef}
+\alias{clusteringCoef}
+\title{Calculate clustering coefficient for an undirected graph}
+\description{Calculate clustering coefficient for an undirected graph }
+
+\usage{
+clusteringCoef(g, Weighted=FALSE, vW=degree(g))
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+  \item{Weighted}{calculate weighted clustering coefficient or not}
+  \item{vW}{vertex weights to use when calculating weighted clustering coefficient}
+}
+
+\details{
+For an undirected graph \code{G}, let delta(v) be the number of triangles with
+\code{v}  
+as a node, let tau(v) be the number of triples, i.e., paths of length 2 with 
+\code{v} as the center node.  
+
+Let V' be the set of nodes with degree at least 2.
+
+Define clustering coefficient for \code{v}, c(v) = (delta(v) / tau(v)). 
+
+Define clustering coefficient for \code{G}, C(G) = sum(c(v)) / |V'|, 
+for all \code{v} in V'. 
+
+Define weighted clustering coefficient for \code{g}, 
+Cw(G) = sum(w(v) * c(v)) / sum(w(v)), for all \code{v} in V'.
+}
+
+\value{
+Clustering coefficient for graph \code{G}.
+}
+
+\references{
+Approximating Clustering Coefficient and Transitivity, T. Schank, D. Wagner, 
+Journal of Graph Algorithms and Applications, Vol. 9, No. 2 (2005).
+}
+
+\author{Li Long \email{li.long at isb-sib.ch}}
+
+\seealso{clusteringCoefAppr, transitivity, graphGenerator}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"))
+g <- fromGXL(con)
+close(con)
+cc <- clusteringCoef(g)
+ccw1 <- clusteringCoef(g, Weighted=TRUE)
+vW  <- c(1, 1, 1, 1, 1,1, 1, 1)
+ccw2 <- clusteringCoef(g, Weighted=TRUE, vW)
+}
+
+\keyword{ models }
diff --git a/man/clusteringCoefAppr.Rd b/man/clusteringCoefAppr.Rd
new file mode 100644
index 0000000..96bb1bc
--- /dev/null
+++ b/man/clusteringCoefAppr.Rd
@@ -0,0 +1,53 @@
+\name{clusteringCoefAppr}
+\alias{clusteringCoefAppr}
+\title{Approximate clustering coefficient for an undirected graph}
+\description{Approximate clustering coefficient for an undirected graph }
+
+\usage{
+clusteringCoefAppr(g, k=length(nodes(g)), Weighted=FALSE, vW=degree(g))
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+  \item{Weighted}{calculate weighted clustering coefficient or not}
+  \item{vW}{vertex weights to use when calculating weighted clustering coefficient}
+  \item{k}{parameter controls total expected runtime}
+}
+
+\details{
+It is quite expensive to compute cluster coefficient and transitivity exactly 
+for a large graph by computing the number of triangles in the graph.  Instead, 
+\code{clusteringCoefAppr} samples triples with appropriate probability, returns
+the ratio between the number of existing edges and the number of samples.   
+
+MORE ABOUT CHOICE OF K.
+
+See reference for more details.
+}
+
+\value{
+Approximated clustering coefficient for graph \code{g}.
+}
+
+\references{
+Approximating Clustering Coefficient and Transitivity, T. Schank, D. Wagner, 
+Journal of Graph Algorithms and Applications, Vol. 9, No. 2 (2005).
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{clusteringCoef, transitivity, graphGenerator}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"))
+g <- fromGXL(con)
+close(con)
+
+k = length(nodes(g))
+cc <- clusteringCoefAppr(g, k)
+ccw1 <- clusteringCoefAppr(g, k, Weighted=TRUE)
+vW  <- c(1, 1, 1, 1, 1,1, 1, 1)
+ccw2 <- clusteringCoefAppr(g, k, Weighted=TRUE, vW)
+}
+
+\keyword{ models }
diff --git a/man/coloring.Rd b/man/coloring.Rd
new file mode 100644
index 0000000..1d5669f
--- /dev/null
+++ b/man/coloring.Rd
@@ -0,0 +1,50 @@
+\name{sequential.vertex.coloring}
+\alias{sequential.vertex.coloring}
+\title{Compute a vertex coloring for a graph}
+\description{Compute vertex coloring for a graph}
+
+\usage{
+sequential.vertex.coloring(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class} 
+}
+
+\details{
+A vertex coloring for a graph is to assign a color for each vertex so that no 
+two adjacent vertices are of the same color.  We designate the colors as 
+sequential integers: 1, 2, ....
+
+For ordered vertices, \code{v1}, \code{v2}, ..., \code{vn}, for k = 1, 2, ..., 
+n, this algorithm assigns \code{vk} to the smallest possible color.  It does 
+NOT guarantee to use minimum number of colors.
+
+See documentations on these algorithms in Boost Graph Library for more details.
+}
+
+\value{
+\item{no. of colors needed}{how many colors to use to color the graph}
+\item{colors of nodes}{ color label for each vertex }
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+sequential.vertex.coloring(coex)
+}
+\keyword{ models }
diff --git a/man/connectedComp.Rd b/man/connectedComp.Rd
new file mode 100644
index 0000000..808fb8d
--- /dev/null
+++ b/man/connectedComp.Rd
@@ -0,0 +1,53 @@
+\name{connectedComp}
+\alias{connectedComp}
+\title{Identify Connected Components in an Undirected Graph  }
+\description{The connected components in an undirected graph are identified. 
+If the graph is directed then the weakly connected components are identified. }
+
+\usage{
+connectedComp(g)
+}
+
+\arguments{
+  \item{g}{ graph with \code{edgemode} \dQuote{undirected}}
+}
+
+\details{
+Uses a depth first search approach to identifying all the connected
+components of an undirected graph. If the input, \code{g}, is a directed
+graph it is first transformed to an undirected graph (using
+\code{\link[graph]{ugraph}}).
+}
+
+\value{
+  A list of length equal to the number of connected components in
+  \code{g}. Each element of the list contains a vector of the node
+  labels for the nodes that are connected.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Vince Carey <stvjc at channing.harvard.edu>}
+
+\seealso{\code{\link[graph:graph-class]{connComp}},\code{\link{strongComp}}, \code{\link[graph]{ugraph}}, \code{\link{same.component}} }
+
+\examples{
+con <- file(system.file("GXL/kmstEx.gxl",package="graph"), open="r")
+km <- fromGXL(con)
+close(con)
+km <- graph::addNode(c("F","G","H"), km)
+km <- addEdge("G", "H", km, 1)
+km <- addEdge("H", "G", km, 1)
+ukm <- ugraph(km)
+ukm
+edges(ukm)
+connectedComp(ukm)
+}
+\keyword{models }
diff --git a/man/dag.sp.Rd b/man/dag.sp.Rd
new file mode 100644
index 0000000..9703661
--- /dev/null
+++ b/man/dag.sp.Rd
@@ -0,0 +1,62 @@
+\name{dag.sp}
+\alias{dag.sp}
+\title{ DAG shortest paths using boost C++ }
+
+\description{
+Algorithm for the single-source shortest-paths problem on a weighted, directed acyclic graph (DAG)
+}
+
+\usage{
+dag.sp(g,start=nodes(g)[1])
+}
+
+\arguments{
+  \item{g}{ instance of class graph }
+  \item{start}{ source node for start of paths }
+}
+
+\details{
+These functions are interfaces to the Boost graph library C++ routines
+for single-source shortest-paths on a weighted directed acyclic graph.
+Choose appropriate shortest-path algorithms carefully based on the properties
+of the input graph.  See documentation in Boost Graph Library for more details.
+}
+
+\value{
+A list with elements:
+\item{distance}{The vector of distances from \code{start} to each node
+of \code{g}; includes \code{Inf} when there is no path from \code{start}.}
+
+\item{penult}{A vector of indices
+(in \code{nodes(g)}) of predecessors corresponding to each node
+on the path from that node back to \code{start}. For example, if the
+element one of this vector has value \code{10}, that means that the
+predecessor of node \code{1} is node \code{10}. The next predecessor is
+found by examining \code{penult[10]}.}
+
+\item{start}{The start node that was supplied in the call to
+\code{dag.sp}.}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\seealso{\code{\link{bellman.ford.sp}}, \code{\link{dijkstra.sp}}, \code{\link{johnson.all.pairs.sp}}, \code{\link{sp.between}} }
+
+\examples{
+con <- file(system.file("XML/conn2.gxl",package="RBGL"), open="r")
+dd <- fromGXL(con)
+close(con)
+dag.sp(dd)
+dag.sp(dd,nodes(dd)[2])
+}
+\keyword{ graphs }
+
diff --git a/man/defunct.Rd b/man/defunct.Rd
new file mode 100644
index 0000000..7222dd3
--- /dev/null
+++ b/man/defunct.Rd
@@ -0,0 +1,16 @@
+\name{RBGL-defunct}
+\alias{RBGL-defunct}
+\title{Defunct Functions in Package \pkg{RBGL}}
+%------ PLEASE: put \alias{.} here for  EACH !
+\alias{prim.minST}
+%
+\description{
+  The functions or variables listed here are no longer part of the RBGL package.
+}
+\usage{
+prim.minST()
+}
+\seealso{
+  \code{\link{Defunct}}
+}
+
diff --git a/man/dijkstra.sp.Rd b/man/dijkstra.sp.Rd
new file mode 100644
index 0000000..99f5521
--- /dev/null
+++ b/man/dijkstra.sp.Rd
@@ -0,0 +1,65 @@
+\name{dijkstra.sp}
+\alias{dijkstra.sp}
+\title{ Dijkstra's shortest paths using boost C++ }
+\description{ dijkstra's shortest paths }
+
+\usage{
+dijkstra.sp(g,start=nodes(g)[1], eW=unlist(edgeWeights(g)))
+}
+
+\arguments{
+  \item{g}{ instance of class graph }
+  \item{start}{ character: node name for start of path }
+  \item{eW}{ numeric: edge weights.  }
+}
+
+\details{
+These functions are interfaces to the Boost graph library C++
+routines for Dijkstra's shortest paths.
+
+For some graph subclasses, computing the edge weights can be expensive.
+If you are calling \code{dijkstra.sp} in a loop, you can pass the edge
+weights explicitly to avoid the edge weight creation cost.
+
+}
+
+\value{
+A list with elements:
+\item{distance}{The vector of distances from \code{start} to each node
+of \code{g}; includes \code{Inf} when there is no path from \code{start}.}
+\item{penult}{A vector of indices 
+(in \code{nodes(g)}) of predecessors corresponding to each node
+on the path from that node back to \code{start}}. For example, if the
+element one of this vector has value \code{10}, that means that the
+predecessor of node \code{1} is node \code{10}. The next predecessor is
+found by examining \code{penult[10]}.
+\item{start}{The start node that was supplied in the call to
+\code{dijkstra.sp}.}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ VJ Carey <stvjc at channing.harvard.edu> }
+
+\seealso{\code{\link{bellman.ford.sp}}, \code{\link{dag.sp}}, \code{\link{johnson.all.pairs.sp}}, \code{\link{sp.between}} }
+
+\examples{
+con1 <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+dd <- fromGXL(con1)
+close(con1)
+dijkstra.sp(dd)
+dijkstra.sp(dd,nodes(dd)[2])
+
+con2 <- file(system.file("XML/ospf.gxl",package="RBGL"), open="r")
+ospf <- fromGXL(con2)
+close(con2)
+dijkstra.sp(ospf,nodes(ospf)[6])
+}
+\keyword{ graphs }
diff --git a/man/dominatorTree.Rd b/man/dominatorTree.Rd
new file mode 100644
index 0000000..c7346ba
--- /dev/null
+++ b/man/dominatorTree.Rd
@@ -0,0 +1,47 @@
+\name{dominatorTree}
+\alias{dominatorTree}
+\alias{lengauerTarjanDominatorTree}
+
+\title{Compute dominator tree from a vertex in a directed graph }
+
+\description{Compute dominator tree from a vertex in a directed graph}
+
+\usage{
+dominatorTree(g, start=nodes(g)[1])
+lengauerTarjanDominatorTree(g, start=nodes(g)[1])
+}
+
+\arguments{
+  \item{g}{a directed graph, one instance of the \code{graph} class }
+  \item{start}{a vertex in graph \code{g} }
+}
+
+\details{
+As stated in documentation on Lengauer Tarjan dominator tree in Boost Graph Library:
+
+A vertex u dominates a vertex v, if every path of directed graph from the entry to v must go through u. 
+
+This function builds the dominator tree for a directed graph.
+}
+
+\value{
+  Output is a vector, giving each node its immediate dominator.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{ }
+
+\examples{
+con1 <- file(system.file("XML/dominator.gxl",package="RBGL"), open="r")
+g1 <- fromGXL(con1)
+close(con1)
+
+dominatorTree(g1)
+lengauerTarjanDominatorTree(g1)
+}
+\keyword{ models }
diff --git a/man/edgeConn.Rd b/man/edgeConn.Rd
new file mode 100644
index 0000000..c96aa49
--- /dev/null
+++ b/man/edgeConn.Rd
@@ -0,0 +1,54 @@
+\name{edgeConnectivity}
+\alias{edgeConnectivity}
+\title{computed edge connectivity and min disconnecting set
+for an undirected graph}
+
+\description{computed edge connectivity and min disconnecting set
+for an undirected graph}
+
+\usage{
+edgeConnectivity(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+}
+
+\details{
+Consider a graph G consisting of a single connected component.
+The edge connectivity of G is the minimum number
+of edges in G that can be cut to produce a graph with two
+(disconnected) components.  The set of edges in this cut
+is called the minimum disconnecting set.
+}
+
+\value{
+A list:
+\item{connectivity}{the integer describing the number of edges that must
+be severed to obtain two components}
+\item{minDisconSet}{a list (of length \code{connectivity}) of pairs of node names describing the edges
+that need to be cut to obtain two components}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Vince Carey <stvjc at channing.harvard.edu>}
+
+\seealso{\code{\link{minCut}}, \code{\link{edmonds.karp.max.flow}}, \code{\link{push.relabel.max.flow}}  }
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+edgeConnectivity(coex)
+}
+\keyword{ models }
diff --git a/man/edmondsMaxCardinalityMatching.Rd b/man/edmondsMaxCardinalityMatching.Rd
new file mode 100644
index 0000000..fa96f8d
--- /dev/null
+++ b/man/edmondsMaxCardinalityMatching.Rd
@@ -0,0 +1,66 @@
+\name{edmondsMaxCardinalityMatching}
+\alias{edmondsMaxCardinalityMatching}
+
+\title{edmondsMaxCardinalityMatching}
+
+\description{edmondsMaxCardinalityMatching description }
+
+\usage{
+edmondsMaxCardinalityMatching(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+V <- LETTERS[1:18]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[4+1], g);
+g <- addEdge(V[1+1], V[5+1], g);
+g <- addEdge(V[1+2], V[6+1], g);
+g <- addEdge(V[1+3], V[7+1], g);
+g <- addEdge(V[1+4], V[5+1], g);
+g <- addEdge(V[1+6], V[7+1], g);
+g <- addEdge(V[1+4], V[8+1], g);
+g <- addEdge(V[1+5], V[9+1], g);
+g <- addEdge(V[1+6], V[10+1], g);
+g <- addEdge(V[1+7], V[11+1], g);
+g <- addEdge(V[1+8], V[9+1], g);
+g <- addEdge(V[1+10], V[11+1], g);
+g <- addEdge(V[1+8], V[13+1], g);
+g <- addEdge(V[1+9], V[14+1], g);
+g <- addEdge(V[1+10], V[15+1], g);
+g <- addEdge(V[1+11], V[16+1], g);
+g <- addEdge(V[1+14], V[15+1], g);
+
+x9 <- edmondsMaxCardinalityMatching(g)
+x9
+
+g <- addEdge(V[1+12], V[13+1], g);
+g <- addEdge(V[1+16], V[17+1], g);
+
+x10 <- edmondsMaxCardinalityMatching(g)
+x10
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/edmondsOptimumBranching.Rd b/man/edmondsOptimumBranching.Rd
new file mode 100644
index 0000000..68d7d9b
--- /dev/null
+++ b/man/edmondsOptimumBranching.Rd
@@ -0,0 +1,43 @@
+\name{edmondsOptimumBranching}
+\alias{edmondsOptimumBranching}
+
+\title{edmondsOptimumBranching}
+
+\description{edmondsOptimumBranching description }
+
+\usage{
+edmondsOptimumBranching(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+\details{
+This is an implementation of Edmonds' algorithm to find optimum branching in a directed graph.  See references for details.
+}
+
+%\value{
+%}
+
+\references{
+See Edmonds' Algorithm on http://edmonds-alg.sourceforge.net.
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+V <- LETTERS[1:4]
+g <- new("graphNEL", nodes=V, edgemode="directed")
+g <- addEdge(V[1+0],V[1+1],g, 3)
+g <- addEdge(V[1+0],V[2+1],g, 1.5)
+g <- addEdge(V[1+0],V[3+1],g, 1.8)
+g <- addEdge(V[1+1],V[2+1],g, 4.3)
+g <- addEdge(V[1+2],V[3+1],g, 2.2)
+
+x11 <- edmondsOptimumBranching(g)
+x11
+}
+
+\keyword{ graphs }
+
diff --git a/man/extractPath.Rd b/man/extractPath.Rd
new file mode 100644
index 0000000..4bed71e
--- /dev/null
+++ b/man/extractPath.Rd
@@ -0,0 +1,40 @@
+\name{extractPath}
+\alias{extractPath}
+\title{convert a dijkstra.sp predecessor structure into the path joining two nodes   }
+
+\description{
+determine a path between two nodes in a graph,
+using output of \code{\link{dijkstra.sp}}.
+}
+
+\usage{
+extractPath(s, f, pens)
+}
+
+\arguments{
+  \item{s}{ index of starting node in nodes vector
+of the graph from which \code{pens} was derived}
+  \item{f}{ index of ending node in nodes vector }
+  \item{pens}{ predecessor index vector as returned
+in the \code{preds} component of \code{\link{dijkstra.sp}} output}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Vince Carey <stvjc at channing.harvard.edu>}
+
+\seealso{  \code{\link[e1071:shortestPaths]{allShortestPaths}}}
+
+\examples{
+data(FileDep)
+dd <- dijkstra.sp(FileDep)
+extractPath(1,9,dd$pen)
+}
+\keyword{ models }
diff --git a/man/floyd.warshall.all.pairs.sp.Rd b/man/floyd.warshall.all.pairs.sp.Rd
new file mode 100644
index 0000000..e33e489
--- /dev/null
+++ b/man/floyd.warshall.all.pairs.sp.Rd
@@ -0,0 +1,49 @@
+\name{floyd.warshall.all.pairs.sp}
+\alias{floyd.warshall.all.pairs.sp}
+\title{compute shortest paths for all pairs of nodes}
+
+\description{ compute shortest paths for all pairs of nodes }
+
+\usage{
+floyd.warshall.all.pairs.sp(g)
+}
+
+\arguments{
+  \item{g}{ graph object with edge weights given}
+}
+
+\details{
+Compute shortest paths between every pair of vertices for a dense graph.  
+It works on both undirected and directed graph.
+The result is given as a distance matrix.  The matrix is symmetric for an
+undirected graph, and asymmetric (very likely) for a directed graph.
+For a sparse graph, the \code{johnson.all.pairs.sp} functions
+should be used instead.
+
+See documentation on these algorithms in Boost Graph Library for more details.
+}
+
+\value{
+A matrix of shortest path lengths between all pairs of nodes in the graph.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{johnson.all.pairs.sp}}} 
+
+\examples{
+con <- file(system.file("XML/conn.gxl", package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+floyd.warshall.all.pairs.sp(coex)
+}
+\keyword{ models }
diff --git a/man/gprofile.Rd b/man/gprofile.Rd
new file mode 100644
index 0000000..dc70b4e
--- /dev/null
+++ b/man/gprofile.Rd
@@ -0,0 +1,46 @@
+\name{gprofile}
+\alias{gprofile}
+\title{Compute profile for a graph}
+
+\description{Compute profile for a graph}
+
+\usage{
+gprofile(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class} 
+}
+
+\details{
+The profile of a given graph is the sum of bandwidths for all the vertices in 
+the graph.
+
+See documentation on this function in Boost Graph Library for more details.
+}
+
+\value{
+\item{profile}{the profile of the graph}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+gprofile(coex)
+}
+\keyword{ models }
diff --git a/man/graphGenerator.Rd b/man/graphGenerator.Rd
new file mode 100644
index 0000000..dfb382e
--- /dev/null
+++ b/man/graphGenerator.Rd
@@ -0,0 +1,45 @@
+\name{graphGenerator}
+\alias{graphGenerator}
+\title{Generate an undirected graph with adjustable clustering coefficient}
+
+\description{Generate an undirected graph with adjustable clustering coefficient }
+
+\usage{
+graphGenerator(n, d, o)
+}
+
+\arguments{
+  \item{n}{no. of nodes in the generated graph}
+  \item{d}{parameter for preferential attachment}
+  \item{o}{parameter for triple generation}
+}
+
+\details{
+The graph generator works according to the prefential attachment rule.  It also generates graphs with adjustable clustering coefficient.  Parameter \code{d} specifies how many preferred edges a new node has.  Parameter \code{o} limits how many triples to add to a new node.
+
+See reference for details.
+}
+
+\value{
+\item{no. of nodes}{No. of nodes in the generated graph}
+\item{no. of edges}{No. of edges in the generated graph}
+\item{edges}{Edges in the generated graph}
+}
+
+\references{
+Approximating Clustering Coefficient and Transitivity, T. Schank, D. Wagner, 
+Journal of Graph Algorithms and Applications, Vol. 9, No. 2 (2005).
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{clusteringCoef, transitivity, clusteringCoefAppr}
+
+\examples{
+n <- 20
+d <- 6
+o <- 3
+gg <- graphGenerator(n, d, o)
+}
+
+\keyword{ models }
diff --git a/man/highlyConnSG.Rd b/man/highlyConnSG.Rd
new file mode 100644
index 0000000..33f7c34
--- /dev/null
+++ b/man/highlyConnSG.Rd
@@ -0,0 +1,64 @@
+\name{highlyConnSG}
+\alias{highlyConnSG}
+
+\title{Compute highly connected subgraphs for an undirected graph}
+
+\description{Compute highly connected subgraphs for an undirected graph}
+
+\usage{
+highlyConnSG(g, sat=3, ldv=c(3,2,1))
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+  \item{sat}{singleton adoption threshold, positive integer }
+  \item{ldv}{heuristics to remove lower degree vertice, a decreasing sequence of positive integer }
+}
+
+\details{
+A graph G with n vertices is highly connected if its connectivity k(G) > n/2.  The HCS algorithm partitions a given graph into a set of highly connected subgraphs, by using minimum-cut algorithm recursively.  To improve performance, the approach is refined by adopting singletons, removing low degree vertices and merging clusters.    
+
+On singleton adoption: 
+after each round of partition,  some highly connected subgraphs could be
+singletons (i.e., a subgraph contains only one node).
+To reduce the number of singletons, therefore reduce number of clusters, 
+we try to get "normal" subgraphs to "adopt" them.  If a singleton, s, has n 
+neighbours in a highly connected subgraph c, and n > sat, we add s to c.  
+To adapt to the modified subgraphs, this adoption process is repeated until 
+no further such adoption. 
+
+On lower degree vertices: when the graph has low degree vertices, minimum-cut
+algorithm will just repeatedly separate these vertices from the rest. 
+To reduce such expensive and non-informative computation, we "remove" these 
+low degree vertices first before applying minimum-cut algorithm.  
+Given ldv = (d1, d2, ..., dp), (d[i] > d[i+1] > 0), we repeat the following
+(i from 1 to p): remove all the highly-connected-subgraph found so far; 
+remove vertices with degrees < di; find highly-connected-subgraphs; 
+perform singleton adoptions. 
+
+The Boost implementation does not support self-loops, therefore we 
+signal an error and suggest that users remove self-loops using the 
+function \code{\link{removeSelfLoops}} function. This change does affect 
+degree, but the original article makes no specific reference to self-loops.
+
+}
+
+\value{
+  A list of clusters, each is given as vertices in the graph.
+}
+
+\references{ A Clustering Algorithm based on Graph Connectivity by E. Hartuv, R. Shamir, 1999.  }
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{edgeConnectivity}}, \code{\link{minCut}}, \code{\link{removeSelfLoops}}  }
+
+\examples{
+con <- file(system.file("XML/hcs.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+highlyConnSG(coex)
+}
+\keyword{ models }
diff --git a/man/incrConnComp.Rd b/man/incrConnComp.Rd
new file mode 100644
index 0000000..3e89bd9
--- /dev/null
+++ b/man/incrConnComp.Rd
@@ -0,0 +1,69 @@
+\name{incremental.components}
+\alias{init.incremental.components}
+\alias{incremental.components}
+\alias{same.component}
+
+\title{Compute connected components for an undirected graph}
+
+\description{Compute connected components for an undirected graph}
+
+\usage{
+init.incremental.components(g)
+incremental.components(g)
+same.component(g, node1, node2)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+  \item{node1}{one vertex of the given graph }
+  \item{node2}{another vertex of the given graph }
+}
+
+\details{
+This family of functions work together to calculate the connected 
+components of an undirected graph. The algorithm is based on the 
+disjoint-sets.  It works where the graph is growing by adding new edges.
+Call "init.incremental.components" to initialize the calculation on a new graph.
+Call "incremental.components" to re-calculate connected components after 
+growing the graph.  Call "same.component" to learn if two given vertices 
+are in the same connected components. 
+Currently, the codes can only handle ONE incremental graph at a time.  When you
+start working on another graph by calling "init.incremental.components", the
+disjoint-sets info on the previous graph is lost. 
+See documentation on Incremental Connected Components in Boost Graph Library 
+for more details.
+}
+
+\value{
+  Output from \code{init.incremental.components} is a list of component numbers for each vertex in the graph.
+
+  Output from \code{incremental.components} is a list of component numbers for each vertex in the graph.
+
+  Output from \code{same.component} is true if both nodes are in the same connected component, otherwise it's false. 
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link[graph:graph-class]{connComp}}, \code{\link{connectedComp}}, \code{\link{strongComp}} }
+
+\examples{
+con <- file(system.file("XML/conn2.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+init.incremental.components(coex)
+incremental.components(coex)
+v1 <- 1
+v2 <- 5
+same.component(coex, v1, v2)
+}
+\keyword{ models }
diff --git a/man/is.triangulated.Rd b/man/is.triangulated.Rd
new file mode 100644
index 0000000..48b22d4
--- /dev/null
+++ b/man/is.triangulated.Rd
@@ -0,0 +1,58 @@
+\name{is.triangulated}
+\alias{is.triangulated}
+\title{Decide if a graph is triangulated}
+
+\description{Decide if a graph is triangulated}
+
+\usage{
+is.triangulated(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+An undirected graph G = (V, E) is triangulated (i.e. chordal) if all cycles
+[v1, v2, ..., vk] of length 4 or more have a chord, i.e., an edge
+[vi, vj] with j != i +/- 1 (mod k)
+
+An equivalent definition of chordal graphs is:
+
+G is chordal iff either G is an empty graph, or
+there is an v in V such that
+\enumerate{
+\item the neighborhood of v (i.e., v and its adjacent nodes) forms a clique, and
+\item recursively, G-v is chordal
+}
+
+}
+
+\value{
+The return value is \code{TRUE} if \code{g} is triangulated and \code{FALSE} 
+otherwise. An error is thrown if the graph is not undirected; you might use 
+\code{\link[graph]{ugraph}} to compute the underlying graph.
+}
+
+\references{
+Combinatorial Optimization: algorithms and complexity  (p. 403)
+by C. H. Papadimitriou, K. Steiglitz}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con1 <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con1)
+close(con1)
+
+is.triangulated(coex)
+
+con2 <- file(system.file("XML/hcs.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con2)
+close(con2)
+
+is.triangulated(coex)
+}
+\keyword{ models }
diff --git a/man/isKuratowskiSubgraph.Rd b/man/isKuratowskiSubgraph.Rd
new file mode 100644
index 0000000..81d2545
--- /dev/null
+++ b/man/isKuratowskiSubgraph.Rd
@@ -0,0 +1,59 @@
+\name{isKuratowskiSubgraph}
+\alias{isKuratowskiSubgraph}
+
+\title{isKuratowskiSubgraph}
+
+\description{isKuratowskiSubgraph description }
+
+\usage{
+isKuratowskiSubgraph(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:6]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+0], V[2+1], g)
+g <- addEdge(V[1+0], V[3+1], g)
+g <- addEdge(V[1+0], V[4+1], g)
+g <- addEdge(V[1+0], V[5+1], g)
+g <- addEdge(V[1+1], V[2+1], g)
+g <- addEdge(V[1+1], V[3+1], g)
+g <- addEdge(V[1+1], V[4+1], g)
+g <- addEdge(V[1+1], V[5+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+2], V[4+1], g)
+g <- addEdge(V[1+2], V[5+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+3], V[5+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+
+x4 <- isKuratowskiSubgraph(g)
+x4
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/isStraightLineDrawing.Rd b/man/isStraightLineDrawing.Rd
new file mode 100644
index 0000000..d37bebe
--- /dev/null
+++ b/man/isStraightLineDrawing.Rd
@@ -0,0 +1,63 @@
+\name{isStraightLineDrawing}
+\alias{isStraightLineDrawing}
+
+\title{isStraightLineDrawing}
+
+\description{isStraightLineDrawing description }
+
+\usage{
+isStraightLineDrawing(g, drawing) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+  \item{drawing}{ coordinates of node positions }
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:7]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+1], V[2+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[0+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+g <- addEdge(V[1+5], V[6+1], g)
+g <- addEdge(V[1+6], V[3+1], g)
+g <- addEdge(V[1+0], V[4+1], g)
+g <- addEdge(V[1+1], V[3+1], g)
+g <- addEdge(V[1+3], V[5+1], g)
+g <- addEdge(V[1+2], V[6+1], g)
+g <- addEdge(V[1+1], V[4+1], g)
+g <- addEdge(V[1+1], V[5+1], g)
+g <- addEdge(V[1+1], V[6+1], g)
+
+
+x3 <- chrobakPayneStraightLineDrawing(g)
+
+x8 <- isStraightLineDrawing(g, x3)
+x8
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/isomorphism.Rd b/man/isomorphism.Rd
new file mode 100644
index 0000000..ffb89cb
--- /dev/null
+++ b/man/isomorphism.Rd
@@ -0,0 +1,55 @@
+\name{isomorphism}
+\alias{isomorphism}
+
+\title{Compute isomorphism from vertices in one graph to those in another graph}
+
+\description{Compute isomorphism from vertices in one graph to those in another graph}
+
+\usage{
+isomorphism(g1, g2)
+}
+
+\arguments{
+  \item{g1}{one instance of the \code{graph} class }
+  \item{g2}{one instance of the \code{graph} class }
+}
+
+\details{
+As stated in documentation on isomorphism in Boost Graph Library:
+An isomorphism is a 1-to-1 mapping of the vertices in one graph to the vertices 
+of another graph such that adjacency is preserved. Another words, given graphs 
+G1 = (V1,E1) and G2 = (V2,E2) an isomorphism is a function f such that for all 
+pairs of vertices a,b in V1, edge (a,b) is in E1 if and only if edge (f(a),f(b))
+is in E2.
+
+}
+
+\value{
+  Output is true if there exists an isomorphism between g1 and g2, otherwise it's false.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{ }
+
+\examples{
+con1 <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+g1 <- fromGXL(con1)
+close(con1)
+
+con2 <- file(system.file("XML/conn2.gxl",package="RBGL"), open="r")
+g2 <- fromGXL(con2)
+close(con2)
+
+isomorphism(g1, g2)
+}
+\keyword{ models }
diff --git a/man/johnson.all.pairs.sp.Rd b/man/johnson.all.pairs.sp.Rd
new file mode 100644
index 0000000..1dc4257
--- /dev/null
+++ b/man/johnson.all.pairs.sp.Rd
@@ -0,0 +1,45 @@
+\name{johnson.all.pairs.sp}
+\alias{johnson.all.pairs.sp}
+
+\title{compute shortest path distance matrix for all pairs of nodes}
+
+\description{ compute shortest path distance matrix for all pairs of nodes }
+
+\usage{
+johnson.all.pairs.sp(g)
+}
+
+\arguments{
+  \item{g}{ graph object for which edgeMatrix and edgeWeights are defined}
+}
+
+\details{
+Uses BGL algorithm.
+}
+
+\value{
+matrix of shortest path lengths, read from row node to col node
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Vince Carey <stvjc at channing.harvard.edu>}
+%\note{  }
+
+\seealso{\code{\link{bellman.ford.sp}}, \code{\link{dag.sp}}, \code{\link{dijkstra.sp}}, \code{\link{sp.between}} }
+
+\examples{
+con <- file(system.file("dot/joh.gxl", package="RBGL"), open="r")
+z <- fromGXL(con)
+close(con)
+
+johnson.all.pairs.sp(z)
+}
+\keyword{ models }
diff --git a/man/kCliques.Rd b/man/kCliques.Rd
new file mode 100644
index 0000000..6b01389
--- /dev/null
+++ b/man/kCliques.Rd
@@ -0,0 +1,55 @@
+\name{kCliques}
+\alias{kCliques}
+\title{Find all the k-cliques in an undirected graph}
+
+\description{Find all the k-cliques in an undirected graph }
+
+\usage{
+kCliques(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+Notice that there are different definitions of k-clique in different context.
+
+In computer science, a k-clique of a graph is a clique, i.e., a complete subgraph, of k nodes. 
+
+In Social Network Analysis, a k-clique in a graph is a subgraph where the distance between any two nodes is no greater than k.
+
+Here we take the definition in Social Network Analysis.
+
+Let D be a matrix, D[i][j] is the shortest path from node i to node j.  Algorithm is outlined as following: 
+(1) use Johnson's algorithm to fill D; let N = max(D[i][j]) for all i, j; 
+(2) each edge is a 1-clique by itself; 
+(3) for k = 2, ..., N, try to expand each (k-1)-clique to k-clique: 
+    (3.1) consider a (k-1)-clique the current k-clique KC;
+    (3.2) repeat the following:
+          if for all nodes j in KC, D[v][j] <= k, add node v to KC;
+    (3.3) eliminate duplicates;
+(4) the whole graph is N-clique.
+}
+
+\value{
+A list of length N; k-th entry (k = 1, ..., N) is a list of all the k-cliques in graph \code{g}. 
+}
+
+\references{
+Social Network Analysis: Methods and Applications.  By S. Wasserman and K. Faust, pp. 258. 
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/snacliqueex.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+kCliques(coex)
+}
+
+\keyword{ models }
diff --git a/man/kCores.Rd b/man/kCores.Rd
new file mode 100644
index 0000000..0d67577
--- /dev/null
+++ b/man/kCores.Rd
@@ -0,0 +1,58 @@
+\name{kCores}
+\alias{kCores}
+\title{Find all the k-cores in a graph}
+
+\description{Find all the k-cores in a graph }
+
+\usage{
+kCores(g, EdgeType=c("in", "out"))
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+  \item{EdgeType}{what types of edges to be considered when \code{g} is directed }
+}
+
+\details{
+A k-core in a graph is a subgraph where each node is adjacent to at least a minimum number, k, of the other nodes in the subgraph.
+
+A k-core in a graph may not be connected.  
+
+The core number for each node is the highest k-core this node is in.  A node in
+a k-core will be, by definition, in a (k-1)-core.
+
+The implementation is based on the algorithm by V. Batagelj and M. Zaversnik, 2002.
+
+The example \code{snacoreex.gxl} is in the paper by V. Batagelj and M. Zaversnik, 2002.
+}
+\value{
+A vector of the core numbers for all the nodes in \code{g}.
+}
+
+\references{
+Social Network Analysis: Methods and Applications.  By S. Wasserman and K. Faust, pp. 266. 
+An O(m) Algorithm for Cores decomposition of networks, by V. Batagelj and M. Zaversnik, 2002.
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con1 <- file(system.file("XML/snacoreex.gxl",package="RBGL"))
+kcoex <- fromGXL(con1)
+close(con1)
+
+kCores(kcoex)
+
+con2 <- file(system.file("XML/conn2.gxl",package="RBGL"))
+kcoex2 <- fromGXL(con2)
+close(con2)
+
+kCores(kcoex2)
+kCores(kcoex2, "in")
+kCores(kcoex2, "out")
+
+}
+
+\keyword{ models }
diff --git a/man/lambdaSets.Rd b/man/lambdaSets.Rd
new file mode 100644
index 0000000..1d8c4c8
--- /dev/null
+++ b/man/lambdaSets.Rd
@@ -0,0 +1,55 @@
+\name{lambdaSets}
+\alias{lambdaSets}
+
+\title{Find all the lambda-sets in an undirected graph}
+
+\description{Find all the lambda-sets in an undirected graph }
+
+\usage{
+lambdaSets(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+From reference (1), p. 270:
+A set of nodes is a lambda-set if any pair of nodes in the lambda set has 
+larger edge connectivity than any pair of nodes consisting of one node from 
+within the lamda set and a second node from outside the lamda set.
+
+As stated in reference (2), a lambda set is a maximal subset of nodes who have 
+more edge-independent paths connecting them to each other than to outsiders.
+
+A lambda set could be characterized by the minimum edge connectivity \code{k}
+among its members, and could be called \code{lambda-k} sets.
+
+Let N be maximum edge connectivity of graph \code{g},
+we output all the lambda-k set for all k = 1, ..., N.
+}
+
+\value{
+Maximum edge connectivity, \code{N}, of the graph \code{g}, and
+A list of length N; k-th entry (k = 1, ..., N) is a list of all the lambda-k 
+sets in graph \code{g}. 
+}
+
+\references{
+(1) Social Network Analysis: Methods and Applications.  By S. Wasserman and K. Faust, pp. 269. 
+(2) LS sets, lambda sets and other cohesive subsets.  By S. P. Borgatti, M. G. Everett, P. R. Shirey, Social Networks 12 (1990) p. 337-357
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/snalambdaex.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+lambdaSets(coex)
+}
+
+\keyword{ models }
diff --git a/man/layout.Rd b/man/layout.Rd
new file mode 100644
index 0000000..a0d02de
--- /dev/null
+++ b/man/layout.Rd
@@ -0,0 +1,104 @@
+\name{layout}
+\alias{circle.layout}
+\alias{circleLayout}
+\alias{kamada.kawai.spring.layout}
+\alias{kamadaKawaiSpringLayout}
+\alias{fruchtermanReingoldForceDirectedLayout}
+\alias{gursoyAtunLayout}
+\alias{randomGraphLayout}
+
+\title{Layout an undirected graph in 2D -- suspended june 16 2012}
+
+\description{Layout an undirected graph in 2D -- suspended june 16 2012}
+
+\usage{
+circleLayout(g, radius=1) # does not compile with boost 1.49
+kamadaKawaiSpringLayout( g, edge_or_side=1, es_length=1 )
+fruchtermanReingoldForceDirectedLayout(g, width=1, height=1)
+randomGraphLayout(g, minX=0, maxX=1, minY=0, maxY=1)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+  \item{radius}{radius of a regular n-polygon}
+
+  \item{edge_or_side}{boolean indicating the length is for an edge or for a 
+    side, default is for an edge }
+  \item{es_length}{the length of an edge or a side for layout }
+
+  \item{width}{the width of the dislay area, all x coordinates fall in [-width/2, width/2]}
+  \item{height}{the height of the display area, all y coordinates fall in [-height/2, height/2]}
+
+  \item{minX}{minimum x coordinate}
+  \item{maxX}{maximum x coordinate}
+  \item{minY}{minimum y coordinate}
+  \item{maxY}{maximum y coordinate}
+  
+}
+
+\details{
+If you want to simply draw a graph, you should consider using package 
+\emph{Rgraphviz}.  The layout options in package \emph{Rgraphviz}: \code{neato},
+\code{circo} and \code{fdp}, correspond to \code{kamadaKawaiSpringLayout}, 
+\code{circleLayout} and \code{fruchtermanReingoldForceDirectedLayout}, 
+respectively. 
+
+Function \code{circleLayout} layouts the graph with the vertices at the points 
+of a regular n-polygon.  The distance from the center of the polygon to each 
+point is determined by the \code{radius} parameter.
+
+Function \code{kamadaKawaiSpringLayout} provides Kamada-Kawai spring layout for 
+connected, undirected graphs.  User provides either the unit length e of an 
+edge in the layout or the length of a side s of the display area.
+
+Function \code{randomGraphLayout} places the points of the graph at random locations.
+
+Function \code{fruchtermanReingoldForceDirectedLayout} performs layout of 
+unweighted, undirected graphs.  It's a force-directed algorithm.  The BGL 
+implementation doesn't handle disconnected graphs very well, since it doesn't
+explicitly give each connected component a region proportional to its size. 
+
+%Function \code{gursoyAtunLayout} performs layout by distributing vertices 
+%within a topology.  It's based on self-organized maps.
+
+See documentation on this function in Boost Graph Library for more details.
+}
+
+\value{
+  A (2 x n) matrix, where n is the number of nodes in the graph, each column
+gives the (x, y)-coordinates for the corresponding node.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{ \code{\link[Rgraphviz]{layoutGraph}} }
+
+\examples{
+\dontrun{
+con <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+coex <- ugraph(coex)
+
+circleLayout(coex)
+
+kamadaKawaiSpringLayout(coex)
+
+randomGraphLayout(coex)
+
+fruchtermanReingoldForceDirectedLayout(coex, 10, 10)
+}
+
+}
+\keyword{ models }
diff --git a/man/makeBiconnectedPlanar.Rd b/man/makeBiconnectedPlanar.Rd
new file mode 100644
index 0000000..6b869a0
--- /dev/null
+++ b/man/makeBiconnectedPlanar.Rd
@@ -0,0 +1,56 @@
+\name{makeBiconnectedPlanar}
+\alias{makeBiconnectedPlanar}
+
+\title{makeBiconnectedPlanar}
+
+\description{makeBiconnectedPlanar description }
+
+\usage{
+makeBiconnectedPlanar(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:11]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[0+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+g <- addEdge(V[1+5], V[3+1], g)
+g <- addEdge(V[1+5], V[6+1], g)
+g <- addEdge(V[1+6], V[7+1], g)
+g <- addEdge(V[1+7], V[8+1], g)
+g <- addEdge(V[1+8], V[5+1], g)
+g <- addEdge(V[1+8], V[9+1], g)
+g <- addEdge(V[1+0], V[10+1], g)
+
+x6 <- makeBiconnectedPlanar(g)
+x6
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/makeConnected.Rd b/man/makeConnected.Rd
new file mode 100644
index 0000000..b5823bb
--- /dev/null
+++ b/man/makeConnected.Rd
@@ -0,0 +1,53 @@
+\name{makeConnected}
+\alias{makeConnected}
+
+\title{makeConnected}
+
+\description{makeConnected description }
+
+\usage{
+makeConnected(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:11]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+5], V[6+1], g)
+g <- addEdge(V[1+6], V[7+1], g)
+g <- addEdge(V[1+8], V[9+1], g)
+g <- addEdge(V[1+9], V[10+1], g)
+g <- addEdge(V[1+10], V[8+1], g)
+
+
+x5 <- makeConnected(g)
+x5
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/makeMaximalPlanar.Rd b/man/makeMaximalPlanar.Rd
new file mode 100644
index 0000000..8a037d7
--- /dev/null
+++ b/man/makeMaximalPlanar.Rd
@@ -0,0 +1,53 @@
+\name{makeMaximalPlanar}
+\alias{makeMaximalPlanar}
+
+\title{makeMaximalPlanar}
+
+\description{makeMaximalPlanar description }
+
+\usage{
+makeMaximalPlanar(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+%
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:10]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+1], V[2+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+g <- addEdge(V[1+5], V[6+1], g)
+g <- addEdge(V[1+6], V[7+1], g)
+g <- addEdge(V[1+7], V[8+1], g)
+g <- addEdge(V[1+8], V[9+1], g)
+
+x7 <- makeMaximalPlanar(g)
+x7
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/maxClique.Rd b/man/maxClique.Rd
new file mode 100644
index 0000000..f408d28
--- /dev/null
+++ b/man/maxClique.Rd
@@ -0,0 +1,58 @@
+\name{maxClique}
+\alias{maxClique}
+
+\title{Find all the cliques in a graph}
+
+\description{Find all the cliques in a graph }
+
+\usage{
+maxClique(g, nodes=NULL, edgeMat=NULL)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+ \item{nodes}{vector of node names, to be supplied if \code{g} is not}
+ \item{edgeMat}{2 x p matrix with indices of edges in nodes, one-based,
+   only to be supplied if code{g} is not}
+}
+
+\details{
+Notice the maximum clique problem is NP-complete, which means it 
+cannot be solved by any known polynomial algorithm.
+
+We implemented the algorithm by C. Bron and J. Kerbosch, 
+
+It is an error to supply both \code{g} and either of the other arguments.
+
+If \code{g} is not supplied, no checking of the consistency of
+\code{nodes} and \code{edgeMat} is performed.
+}
+
+\value{
+\item{maxClique}{list of all cliques in \code{g}}
+}
+
+\references{
+Finding all cliques of an undirected graph, 
+by C. Bron and J. Kerbosch, 
+Communication of ACM, Sept 1973, Vol 16, No. 9.
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con1 <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con1)
+close(con1)
+
+maxClique(coex)
+
+con2 <- file(system.file("XML/hcs.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con2)
+close(con2)
+
+maxClique(coex)
+}
+\keyword{ models }
diff --git a/man/maxFlow.Rd b/man/maxFlow.Rd
new file mode 100644
index 0000000..147baa7
--- /dev/null
+++ b/man/maxFlow.Rd
@@ -0,0 +1,69 @@
+\name{max.flow}
+\alias{edmonds.karp.max.flow}
+\alias{push.relabel.max.flow}
+\alias{kolmogorov.max.flow}
+
+\title{Compute max flow for a directed graph }
+
+\description{Compute max flow for a directed graph }
+
+\usage{
+edmonds.karp.max.flow(g, source, sink)
+push.relabel.max.flow(g, source, sink)
+kolmogorov.max.flow(g, source, sink)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{directed}}
+  \item{source}{ node name (character) or node number (int) for the source of the flow }
+  \item{sink}{ node name (character) or node number (int) for the sink of the flow }
+}
+
+\details{
+Given a directed graph G=(V, E) of a single connected component with a vertex 
+\code{source} and a vertex \code{sink}.  Each arc has a positive real valued 
+capacity, currently it's equivalent to the weight of the arc.  The flow of the 
+network is the net flow entering the vertex \code{sink}. The maximum flow 
+problem is to determine the maximum possible value for the flow to the 
+\code{sink} and the corresponding flow values for each arc. 
+
+See documentation on these algorithms in Boost Graph Library for more details.
+}
+
+\value{
+  A list of
+\item{maxflow}{the max flow from \code{source} to \code{sink} }
+\item{edges}{the nodes of the arcs with non-zero capacities}
+\item{flows}{the flow values of the arcs with non-zero capacities}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{minCut}}, \code{\link{edgeConnectivity}}}
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+g <- fromGXL(con)
+close(con)
+
+ans1 <- edmonds.karp.max.flow(g, "B", "D")
+ans2 <- edmonds.karp.max.flow(g, 3, 2)     # 3 and 2 equivalent to "C" and "B"
+
+ans3 <- push.relabel.max.flow(g, 2, 4)     # 2 and 4 equivalent to "B" and "D"
+ans4 <- push.relabel.max.flow(g, "C", "B")
+
+# error in the following  now, 14 june 2014
+#ans5 <- kolmogorov.max.flow(g, "B", "D")
+#ans6 <- kolmogorov.max.flow(g, 3, 2)     
+}
+\keyword{ models }
diff --git a/man/maximumCycleRatio.Rd b/man/maximumCycleRatio.Rd
new file mode 100644
index 0000000..d8b5d29
--- /dev/null
+++ b/man/maximumCycleRatio.Rd
@@ -0,0 +1,37 @@
+\name{maximumCycleRatio}
+\alias{maximumCycleRatio}
+
+\title{maximumCycleRatio}
+
+\description{maximumCycleRatio description }
+
+\usage{
+maximumCycleRatio(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+%
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+%\examples{
+% }
+
+\keyword{ graphs }
+
diff --git a/man/minCut.Rd b/man/minCut.Rd
new file mode 100644
index 0000000..dfe8b88
--- /dev/null
+++ b/man/minCut.Rd
@@ -0,0 +1,54 @@
+\name{minCut}
+\alias{minCut}
+
+\title{Compute min-cut for an undirected graph}
+
+\description{Compute min-cut for an undirected graph}
+
+\usage{
+minCut(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+}
+
+\details{
+Given an undirected graph G=(V, E) of a single connected component, a cut is 
+a partition of the set of vertices into two non-empty subsets S and V-S, a 
+cost is the number of edges that are incident on one vertex in S and one 
+vertex in V-S.  The min-cut problem is to find a cut (S, V-S) of minimum cost.
+
+For simplicity, the returned subset S is the smaller of the two subsets.
+
+}
+
+\value{
+  A list of 
+\item{mincut}{the number of edges to be severed to obtain the minimum cut}
+\item{S}{the smaller subset of vertices in the minimum cut}
+\item{V-S}{the other subset of vertices in the minimum cut}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{edgeConnectivity}}}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+minCut(coex)
+}
+\keyword{ models }
diff --git a/man/minimumCycleRatio.Rd b/man/minimumCycleRatio.Rd
new file mode 100644
index 0000000..e16fd35
--- /dev/null
+++ b/man/minimumCycleRatio.Rd
@@ -0,0 +1,37 @@
+\name{minimumCycleRatio}
+\alias{minimumCycleRatio}
+
+\title{minimumCycleRatio}
+
+\description{minimumCycleRatio description }
+
+\usage{
+minimumCycleRatio(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+%\examples{
+% }
+
+\keyword{ graphs }
+
diff --git a/man/mstree.kruskal.Rd b/man/mstree.kruskal.Rd
new file mode 100644
index 0000000..cc483e1
--- /dev/null
+++ b/man/mstree.kruskal.Rd
@@ -0,0 +1,60 @@
+\name{mstree.kruskal}
+\alias{mstree.kruskal}
+%- Also NEED an `\alias' for EACH other topic documented here.
+
+\title{ Kruskal's minimum spanning tree in boost }
+
+\description{ compute the minimum spanning tree (MST) for
+a graph and return a representation in matrices }
+
+\usage{
+mstree.kruskal(x) 
+}
+%- maybe also `usage' for other objects documented here.
+
+\arguments{
+  \item{x}{ instance of class graph }
+}
+
+\details{
+calls to kruskal minimum spanning tree algorithm of Boost graph library
+}
+
+\value{
+a list \item{edgeList}{a matrix m of dimension 2 by number of edges in the
+MST, with m[i,j] the jth node in edge i}
+\item{weights}{a vector of edge weights corresponding to the
+columns of \code{edgeList}}
+\item{nodes}{the vector of nodes of the input graph \code{x}}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ VJ Carey <stvjc at channing.harvard.edu> }
+
+
+\examples{
+con1 <- file(system.file("XML/kmstEx.gxl",package="RBGL"), open="r")
+km <- fromGXL(con1)
+close(con1)
+
+mstree.kruskal(km)
+edgeData(km, "B", "D", "weight") <- 1.1
+edgeData(km, "B", "E", "weight") <- .95
+mstree.kruskal(km)
+
+con2 <- file(system.file("XML/telenet.gxl",package="RBGL"), open="r")
+km2 <- fromGXL(con2)
+close(con2)
+
+m <- mstree.kruskal(km2)
+print(sum(m[[2]]))
+}
+\keyword{ graphs }% at least one, from doc/KEYWORDS
diff --git a/man/mstree.prim.Rd b/man/mstree.prim.Rd
new file mode 100644
index 0000000..bca9914
--- /dev/null
+++ b/man/mstree.prim.Rd
@@ -0,0 +1,50 @@
+\name{mstree.prim}
+\alias{mstree.prim}
+
+\title{Compute minimum spanning tree for an undirected graph}
+
+\description{Compute minimum spanning tree for an undirected graph}
+
+\usage{
+mstree.prim(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+}
+
+\details{
+This is Prim's algorithm for solving the minimum spanning tree problem for an 
+undirected graph with weighted edges. 
+
+See documentations on this function in Boost Graph Library for more details.
+}
+
+\value{
+  A list of
+\item{edges}{the edges that form the minimum spanning tree}
+\item{weights}{the total weight of the minimum spanning tree}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{mstree.kruskal}}}
+
+\examples{
+con <- file(system.file("XML/conn2.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+mstree.prim(coex)
+}
+\keyword{ models }
diff --git a/man/ordering.Rd b/man/ordering.Rd
new file mode 100644
index 0000000..ca3101d
--- /dev/null
+++ b/man/ordering.Rd
@@ -0,0 +1,89 @@
+\name{Ordering}
+\alias{cuthill.mckee.ordering}
+\alias{minDegreeOrdering}
+\alias{sloan.ordering}
+\alias{kingOrdering}
+
+\title{Compute vertex ordering for an undirected graph}
+
+\description{Compute vertex ordering for an undirected graph}
+
+\usage{
+cuthill.mckee.ordering(g)
+minDegreeOrdering(g, delta=0)
+sloan.ordering(g, w1=1, w2=2)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class with \code{edgemode}
+    \dQuote{undirected}}
+  \item{delta}{Multiple elimination control variable. If it is larger than or 
+    equal to zero then multiple elimination is enabled. The value of delta 
+    specifies the difference between the minimum degree and the degree of 
+    vertices that are to be eliminated.}
+  \item{w1}{ First heuristic weight for the Sloan algorithm. }
+  \item{w2}{ Second heuristic weight for the Sloan algorithm. }
+}
+
+\details{
+ The following details were obtained from 
+the documentation of these algorithms in Boost Graph 
+Library and readers are referred their for even more detail.
+The goal of the Cuthill-Mckee (and reverse Cuthill-Mckee) ordering algorithm is
+to reduce the bandwidth of a graph by reordering the indices assigned to each
+vertex. 
+
+The minimum degree ordering algorithm is a fill-in reduction matrix reordering
+algorithm. 
+
+The goal of the Sloan ordering algorithm is to reduce the profile and the
+wavefront of a graph by reordering the indices assigned to each vertex. 
+
+The goal of the King ordering algorithm is to reduce the bandwidth of a graph 
+by reordering the indices assigned to each vertex.
+
+}
+
+\value{
+\item{cuthill.mckee.ordering}{ returns a list with elements:}
+     \item{reverse cuthill.mckee.ordering}{the vertices in the new ordering}
+     \item{original bandwidth}{bandwidth before reordering vertices}
+     \item{new bandwidth}{bandwidth after reordering of vertices}
+
+\item{minDegreeOrdering}{ return a list with elements:}
+     \item{inverse_permutation}{the new vertex ordering, given as the mapping from the new indices to the old indices }
+     \item{permutation}{the new vertex ordering, given as the mapping from the old indices to the new indices }
+
+\item{sloan.ordering}{ returns a list with elements:}
+     \item{sloan.ordering}{the vertices in the new ordering}
+     \item{bandwidth}{bandwidth of the graph after reordering}
+     \item{profile}{profile of the graph after reordering}
+     \item{maxWavefront}{maxWavefront of the graph after reordering}
+     \item{aver.wavefront}{aver.wavefront of the graph after reordering}
+     \item{rms.wavefront}{rms.wavefront of the graph after reordering}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{ }
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+coex <- ugraph(coex)
+cuthill.mckee.ordering(coex)
+minDegreeOrdering(coex)
+sloan.ordering(coex)
+}
+\keyword{ models }
diff --git a/man/planarCanonicalOrdering.Rd b/man/planarCanonicalOrdering.Rd
new file mode 100644
index 0000000..f960904
--- /dev/null
+++ b/man/planarCanonicalOrdering.Rd
@@ -0,0 +1,56 @@
+\name{planarCanonicalOrdering}
+\alias{planarCanonicalOrdering}
+
+\title{planarCanonicalOrdering}
+
+\description{planarCanonicalOrdering description }
+
+\usage{
+planarCanonicalOrdering(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:6]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0], V[1+1], g)
+g <- addEdge(V[1+1], V[2+1], g)
+g <- addEdge(V[1+2], V[3+1], g)
+g <- addEdge(V[1+3], V[4+1], g)
+g <- addEdge(V[1+4], V[5+1], g)
+g <- addEdge(V[1+5], V[0+1], g)
+g <- addEdge(V[1+0], V[2+1], g)
+g <- addEdge(V[1+0], V[3+1], g)
+g <- addEdge(V[1+0], V[4+1], g)
+g <- addEdge(V[1+1], V[3+1], g)
+g <- addEdge(V[1+1], V[4+1], g)
+g <- addEdge(V[1+1], V[5+1], g)
+
+x2 <- planarCanonicalOrdering(g)
+x2
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/planarFaceTraversal.Rd b/man/planarFaceTraversal.Rd
new file mode 100644
index 0000000..4bf061d
--- /dev/null
+++ b/man/planarFaceTraversal.Rd
@@ -0,0 +1,56 @@
+\name{planarFaceTraversal}
+\alias{planarFaceTraversal}
+
+\title{planarFaceTraversal}
+
+\description{planarFaceTraversal description }
+
+\usage{
+planarFaceTraversal(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+\examples{
+
+V <- LETTERS[1:9]
+g <- new("graphNEL", nodes=V, edgemode="undirected")
+g <- addEdge(V[1+0],V[1+1],g)
+g <- addEdge(V[1+1],V[1+2],g)
+g <- addEdge(V[1+3],V[1+4],g)
+g <- addEdge(V[1+4],V[1+5],g)
+g <- addEdge(V[1+6],V[1+7],g)
+g <- addEdge(V[1+7],V[1+8],g)
+g <- addEdge(V[1+0],V[1+3],g)
+g <- addEdge(V[1+3],V[1+6],g)
+g <- addEdge(V[1+1],V[1+4],g)
+g <- addEdge(V[1+4],V[1+7],g)
+g <- addEdge(V[1+2],V[1+5],g)
+g <- addEdge(V[1+5],V[1+8],g)
+
+x1 <- planarFaceTraversal(g)
+x1
+
+ }
+
+\keyword{ graphs }
+
diff --git a/man/removeSelfLoops.Rd b/man/removeSelfLoops.Rd
new file mode 100644
index 0000000..2c0b07d
--- /dev/null
+++ b/man/removeSelfLoops.Rd
@@ -0,0 +1,37 @@
+\name{removeSelfLoops}
+\alias{removeSelfLoops}
+
+\title{remove self loops in a graph}
+
+\description{remove self loops in a graph}
+
+\usage{
+removeSelfLoops(g)
+}
+
+\arguments{
+  \item{g}{one instance of the \code{graph} class }
+}
+
+\details{
+If a given graph contains self-loop(s), \code{removeSelfLoops} removes them.
+This is for those functions that cannot handle graphs with self-loops.
+}
+
+\value{
+  A new graph without self loops.
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{ }
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"))
+g1 <- fromGXL(con)
+close(con)
+
+g2 <- ugraph(g1)
+removeSelfLoops(g2)
+}
+\keyword{ models }
diff --git a/man/separates.Rd b/man/separates.Rd
new file mode 100644
index 0000000..2adeee6
--- /dev/null
+++ b/man/separates.Rd
@@ -0,0 +1,50 @@
+\name{separates}
+\alias{separates}
+
+\title{ A function to test whether a subset of nodes separates
+ two other subsets of nodes. }
+
+\description{
+The function tests to see whether a set of nodes, \code{S1}, separates 
+all nodes in \code{a} from all nodes in \code{b}.
+}
+
+\usage{
+separates(a, b, S1, g)
+}
+
+\arguments{
+  \item{a}{ The names of the nodes in the from set. }
+  \item{b}{ The names of the nodes in the to set. }
+  \item{S1}{ The names of the nodes in the separation set. }
+  \item{g}{ An instance of the \code{graph} class. All nodes
+     named in the other arguments must be nodes of this graph. }
+}
+
+\details{
+ The algorithm is quite simple. A subgraph is created by removing the
+ nodes named in \code{S1} from \code{g}. Then all paths between
+ elements of \code{a} to elements of \code{b} are tested for. If any
+ path exists the function returns \code{FALSE}, otherwise it returns 
+\code{TRUE}.
+}
+
+\value{
+ Either \code{TRUE} or \code{FALSE} depending on whether \code{S1} separates
+\code{a} from \code{b} in \code{g1}.
+}
+
+\references{ S. Lauritzen, Graphical Models, OUP. }
+
+\author{ R. Gentleman }
+
+\seealso{ \code{\link{johnson.all.pairs.sp}}}
+\examples{
+  con <- file(system.file("XML/kmstEx.gxl",package="RBGL"))
+  km <- fromGXL(con)
+  close(con)
+
+  separates("B", "A", "E", km)
+  separates("B", "A", "C", km)
+}
+\keyword{manip }
diff --git a/man/sloanStartEndVertices.Rd b/man/sloanStartEndVertices.Rd
new file mode 100644
index 0000000..586d186
--- /dev/null
+++ b/man/sloanStartEndVertices.Rd
@@ -0,0 +1,37 @@
+\name{sloanStartEndVertices}
+\alias{sloanStartEndVertices}
+
+\title{sloanStartEndVertices}
+
+\description{sloanStartEndVertices description }
+
+\usage{
+sloanStartEndVertices(g) 
+}
+
+\arguments{
+  \item{g}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+%\details{
+%}
+%
+%\value{
+%}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ Li Long <li.long at isb-sib.ch> }
+
+%\examples{
+% }
+
+\keyword{ graphs }
+
diff --git a/man/sp.between.Rd b/man/sp.between.Rd
new file mode 100644
index 0000000..f5a248e
--- /dev/null
+++ b/man/sp.between.Rd
@@ -0,0 +1,66 @@
+\name{sp.between}
+\alias{sp.between}
+\alias{sp.between.scalar}
+
+\title{ Dijkstra's shortest paths using boost C++ }
+
+\description{ dijkstra's shortest paths }
+
+\usage{
+sp.between(g,start,finish, detail=TRUE) 
+}
+
+\arguments{
+  \item{g}{ instance of class graph }
+  \item{start}{ node name(s) for start of path(s)  }
+  \item{finish}{ node name(s) for end of path(s) }
+  \item{detail}{ if TRUE, output additional info on the shortest path }
+}
+
+\details{
+These functions are interfaces to the Boost graph library C++
+routines for Dijkstra's shortest paths.
+
+Function \code{sp.between.scalar} is obsolete.  
+}
+
+\value{
+When \code{start} and/or \code{finish} are vectors, we use the normal cycling 
+rule in R to match both vectors and try to find the shortest path for each 
+pair.  
+
+Function \code{sp.between} returns a list of info on the shortest paths.  Each
+such shortest path is designated by its starting node and its ending node.  
+Each element in the returned list contains:
+\item{length}{total length (using edge weights) of this shortest path},
+\item{path_detail}{if requested, a vector of names of the nodes on the shortest path},
+\item{length_detail}{if requested, a list of edge weights of this shortest path}.
+
+See \code{\link[graph:edgeMatrix]{pathWeights}} for caveats about undirected graph representation.
+}
+
+\author{ VJ Carey <stvjc at channing.harvard.edu>, Li Long <li.long at isb-sib.ch> }
+
+\seealso{\code{\link{bellman.ford.sp}}, \code{\link{dag.sp}}, \code{\link{dijkstra.sp}}, \code{\link{johnson.all.pairs.sp}}}
+
+\examples{
+
+con <- file(system.file("XML/ospf.gxl",package="RBGL"), open="r")
+ospf <- fromGXL(con)
+close(con)
+
+dijkstra.sp(ospf,nodes(ospf)[6])
+
+sp.between(ospf, "RT6", "RT1")
+
+sp.between(ospf, c("RT6", "RT2"), "RT1", detail=FALSE)
+
+sp.between(ospf, c("RT6", "RT2"), c("RT1","RT5"))
+
+# see NAs for query on nonexistent path
+sp.between(ospf,"N10", "N13")
+
+}
+
+\keyword{ graphs }% at least one, from doc/KEYWORDS
+
diff --git a/man/strongComp.Rd b/man/strongComp.Rd
new file mode 100644
index 0000000..5c62532
--- /dev/null
+++ b/man/strongComp.Rd
@@ -0,0 +1,52 @@
+\name{strongComp}
+\alias{strongComp}
+
+\title{Identify Strongly Connected Components}
+
+\description{The strongly connected components in
+a directed graph are identified and returned as a list.  }
+
+\usage{
+strongComp(g)
+}
+
+\arguments{
+  \item{g}{ graph with \code{edgemode} \dQuote{directed}.}
+}
+
+\details{
+Tarjan's algorithm is used to determine all strongly connected
+components of a \emph{directed graph}.
+}
+
+\value{
+A list whose length is the number of strongly connected components in
+\code{g}. Each element of the list is a vector of the node labels for
+the nodes in that component.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Vince Carey <stvjc at channing.harvard.edu>}
+
+\seealso{\code{\link[graph:graph-class]{connComp}},\code{\link{connectedComp}}, \code{\link{same.component}} }
+
+\examples{
+con <- file(system.file("XML/kmstEx.gxl",package="RBGL"), open="r")
+km <- fromGXL(con)
+close(con)
+
+km<- graph::addNode(c("F","G","H"), km)
+km<- addEdge("G", "H", km, 1)
+km<- addEdge("H", "G", km, 1)
+strongComp(km)
+connectedComp(ugraph(km))
+}
+\keyword{ models }
diff --git a/man/transClosure.Rd b/man/transClosure.Rd
new file mode 100644
index 0000000..acddfd7
--- /dev/null
+++ b/man/transClosure.Rd
@@ -0,0 +1,45 @@
+\name{transitive.closure}
+\alias{transitive.closure}
+
+\title{Compute transitive closure of a directed graph}
+
+\description{Compute  transitive closure of a directed graph}
+
+\usage{
+transitive.closure(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+This function calculates the transitive closure of a directed graph.  
+See documentation on this function in Boost Graph Library for more details.
+}
+
+\value{
+  An object of class \code{graphNEL}.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+%\seealso{}
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+
+transitive.closure(coex)
+}
+\keyword{ models }
diff --git a/man/transitivity.Rd b/man/transitivity.Rd
new file mode 100644
index 0000000..df33146
--- /dev/null
+++ b/man/transitivity.Rd
@@ -0,0 +1,46 @@
+\name{transitivity}
+\alias{transitivity}
+
+\title{Calculate transitivity for an undirected graph}
+
+\description{Calculate transitivity for an undirected graph }
+
+\usage{
+transitivity(g)
+}
+
+\arguments{
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+For an undirected graph \code{G}, let delta(v) be the number of triangles with
+\code{v}  
+as a node, let tau(v) be the number of triples, i.e., paths of length 2 with 
+\code{v} as the center node.
+
+Define transitivity T(G) = sum(delta(v)) / sum(tau(v)), for all v in V.
+}
+
+\value{
+Transitivity for graph \code{g}.
+}
+
+\references{
+Approximating Clustering Coefficient and Transitivity, T. Schank, D. Wagner,
+Journal of Graph Algorithms and Applications, Vol. 9, No. 2 (2005).
+}
+
+\author{Li Long \email{li.long at isb-sib.ch}}
+
+\seealso{clusteringCoef, clusteringCoefAppr, graphGenerator}
+
+\examples{
+con <- file(system.file("XML/conn.gxl",package="RBGL"))
+g <- fromGXL(con)
+close(con)
+
+tc <- transitivity(g)
+}
+
+\keyword{ models }
diff --git a/man/tsort.Rd b/man/tsort.Rd
new file mode 100644
index 0000000..25716ad
--- /dev/null
+++ b/man/tsort.Rd
@@ -0,0 +1,50 @@
+\name{tsort}
+\alias{tsort}
+%- Also NEED an `\alias' for EACH other topic documented here.
+
+\title{ topological sort of vertices of a digraph }
+
+\description{ returns vector of zero-based indices of vertices
+of a DAG in topological sort order }
+
+\usage{
+tsort(x) # now x assumed to be Bioconductor graph graphNEL
+}
+%- maybe also `usage' for other objects documented here.
+
+\arguments{
+  \item{x}{ instance of class graphNEL from Bioconductor graph class}
+}
+
+\details{
+calls to the topological\_sort algorithm of BGL.  will check in BGL
+whether the input is a DAG and return a vector of zeroes (of length 
+length(nodes(x))) if it is not.  Thus this function can be used to check for
+cycles in a digraph.
+}
+
+\value{
+A character vector of vertices in the topological sort sequence.
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{ VJ Carey <stvjc at channing.harvard.edu> }
+
+\examples{
+ data(FileDep)
+ tsind <- tsort(FileDep)
+ tsind
+ FD2 <- FileDep
+ # now introduce a cycle
+ FD2 <- addEdge("bar_o", "dax_h", FD2, 1)
+ tsort(FD2)
+ }
+\keyword{ graphs }% at least one, from doc/KEYWORDS
diff --git a/man/wavefront.Rd b/man/wavefront.Rd
new file mode 100644
index 0000000..1952d44
--- /dev/null
+++ b/man/wavefront.Rd
@@ -0,0 +1,58 @@
+\name{wavefront}
+\alias{ith.wavefront}
+\alias{maxWavefront}
+\alias{aver.wavefront}
+\alias{rms.wavefront}
+
+\title{Compute the i-th/max/average/rms wavefront for a graph}
+
+\description{Compute the i-th/max/average/rms wavefront for a graph}
+
+\usage{
+ith.wavefront(g, start)
+maxWavefront(g)
+aver.wavefront(g)
+rms.wavefront(g)
+}
+
+\arguments{
+  \item{start}{a vertex of the \code{graph} class }
+  \item{g}{an instance of the \code{graph} class }
+}
+
+\details{
+Assorted functions on wavefront of a graph.
+}
+
+\value{
+\item{ith.wavefront}{wavefront of the given vertex}
+\item{maxWavefront}{maximum wavefront of a graph}
+\item{aver.wavefront}{average wavefront of a graph}
+\item{rms.wavefront}{root mean square of all wavefronts}
+}
+
+\references{
+Boost Graph Library ( www.boost.org/libs/graph/doc/index.html )
+
+The Boost Graph Library: User Guide and Reference Manual;
+by Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine;
+(Addison-Wesley, Pearson Education Inc., 2002), xxiv+321pp.
+ISBN 0-201-72914-8
+}
+
+\author{Li Long <li.long at isb-sib.ch>}
+
+\seealso{\code{\link{edgeConnectivity}}  }
+
+\examples{
+con <- file(system.file("XML/dijkex.gxl",package="RBGL"), open="r")
+coex <- fromGXL(con)
+close(con)
+
+ss <- 1
+ith.wavefront(coex, ss)
+maxWavefront(coex)
+aver.wavefront(coex)
+rms.wavefront(coex)
+}
+\keyword{ models }
diff --git a/src/Basic2DMatrix.hpp b/src/Basic2DMatrix.hpp
new file mode 100644
index 0000000..806b3a0
--- /dev/null
+++ b/src/Basic2DMatrix.hpp
@@ -0,0 +1,33 @@
+#ifndef BASIC2DMATRIX_H
+#define BASIC2DMATRIX_H
+
+template <class Object>
+class Basic2DMatrix
+{
+public:
+	Basic2DMatrix( int rows, int cols ) : array( rows )
+	{
+		for( int i = 0; i < rows; i++ )
+			array[ i ].resize( cols );
+	}
+
+	Basic2DMatrix( const Basic2DMatrix & rhs ) : array( rhs.array ) { }
+
+	const std::vector<Object> & operator[]( int row ) const
+	{ return array[ row ]; }
+
+	std::vector<Object> & operator[]( int row )
+	{ return array[ row ]; }
+
+	int numrows( ) const
+	{ return array.size( ); }
+
+	int numcols( ) const
+	{ return numrows( ) ? array[ 0 ].size( ) : 0; }
+
+private:
+	std::vector< std::vector<Object> > array;
+};
+
+#endif  // BASIC2DMATRIX
+
diff --git a/src/RBGL.hpp b/src/RBGL.hpp
new file mode 100644
index 0000000..04963ba
--- /dev/null
+++ b/src/RBGL.hpp
@@ -0,0 +1,142 @@
+/* RBGL2.h -- R interface to Boost Graph Library header */
+/* assumes -IboostIncl for RBGL/src */
+
+#ifndef RBGL_RBGL_H
+#define RBGL_RBGL_H
+
+#include <iostream>
+#include <cstdio>
+#include <vector>
+#include <iterator>
+#include <algorithm>
+#include <time.h>
+
+#include <boost/config.hpp>
+#include <boost/utility.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/generator_iterator.hpp>
+
+/*
+stvjc at stvjc-VT527AA-ABA-p6340f:~/BIOC_DEVEL/RBGL/src$ ls *0/boost/pending
+bucket_sorter.hpp          indirect_cmp.hpp       mutable_queue.hpp
+container_traits.hpp       integer_log2.hpp       property.hpp
+cstddef.hpp                is_heap.hpp            property_serialize.hpp
+detail                     iterator_adaptors.hpp  queue.hpp
+disjoint_sets.hpp          iterator_tests.hpp     relaxed_heap.hpp
+fenced_priority_queue.hpp  lowest_bit.hpp         stringtok.hpp
+fibonacci_heap.hpp         mutable_heap.hpp
+*/
+
+/* #include <boost/pending/integer_range.hpp> */
+#include <boost/pending/indirect_cmp.hpp>
+/* #include <boost/pending/ct_if.hpp> */
+
+#include <boost/type_traits/same_traits.hpp>
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/visitors.hpp>
+
+extern "C" {
+#include <Rdefines.h>
+}
+
+template <class DirectedS = boost::directedS, typename WeightT = double>
+class R_adjacency_list
+            : public boost::adjacency_list<boost::vecS, boost::vecS, DirectedS,
+            boost::property<boost::vertex_color_t, boost::default_color_type>,
+            boost::property<boost::edge_weight_t, WeightT> >
+{
+    typedef boost::adjacency_list<boost::vecS, boost::vecS, DirectedS,
+    boost::property<boost::vertex_color_t, boost::default_color_type>,
+    boost::property<boost::edge_weight_t, WeightT> > Base;
+    typedef WeightT R_weight_type;
+    BOOST_STATIC_ASSERT(boost::is_arithmetic<R_weight_type>::value);
+public:
+    typedef typename Base::graph_property_type graph_property_type;
+    typedef typename Base::vertices_size_type vertices_size_type;
+    typedef typename Base::edges_size_type edges_size_type;
+
+    inline R_adjacency_list()
+            : Base() { }
+    inline R_adjacency_list(const graph_property_type& p)
+            : Base(p) { }
+    inline R_adjacency_list(const Base& x)
+            : Base(x) { }
+    inline R_adjacency_list(vertices_size_type num_vertices)
+            : Base(num_vertices) { }
+    inline R_adjacency_list(vertices_size_type num_vertices,
+                            const graph_property_type& p)
+            : Base(num_vertices, p) { }
+#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
+    // Required by Iterator Constructible Graph
+    template <class EdgeIterator>
+    inline R_adjacency_list(EdgeIterator first, EdgeIterator last,
+                            vertices_size_type n,
+                            edges_size_type m = 0,
+                            const graph_property_type& p = graph_property_type())
+            : Base(first, last, n, m, p) { }
+
+    template <class EdgeIterator, class EdgePropertyIterator>
+    inline R_adjacency_list(EdgeIterator first, EdgeIterator last,
+                            EdgePropertyIterator ep_iter,
+                            vertices_size_type n,
+                            edges_size_type m = 0,
+                            const graph_property_type& p = graph_property_type())
+            : Base(first, last, ep_iter, n, m, p) { }
+#endif
+
+    inline R_adjacency_list(SEXP num_verts_in,
+                            SEXP num_edges_in,
+                            SEXP R_edges_in,
+                            SEXP R_weights_in)
+            : Base(asInteger(num_verts_in))
+    {
+        if (!isNumeric(R_weights_in)) error("R_weights_in should be Numeric");
+        if (!isInteger(R_edges_in)) error("R_edges_in should be integer");
+        int NE = asInteger(num_edges_in);
+        int* edges_in = INTEGER(R_edges_in);
+        if (isReal(R_weights_in)) {
+            if (boost::is_integral<R_weight_type>::value)
+                error("R_weights_in should be integer");
+            else {
+                double* weights_in = REAL(R_weights_in);
+                for (int i = 0; i < NE ; i++, edges_in += 2, weights_in++) {
+                    boost::add_edge(*edges_in, *(edges_in+1),
+                                    *weights_in, *this);
+                }
+            }
+        } else {
+            int* weights_in = INTEGER(R_weights_in);
+            for (int i = 0; i < NE ; i++, edges_in += 2, weights_in++) {
+                boost::add_edge(*edges_in, *(edges_in+1), *weights_in, *this);
+            }
+        }
+    }
+
+    inline R_adjacency_list(SEXP num_verts_in,
+                            SEXP num_edges_in,
+                            SEXP R_edges_in)
+            : Base(asInteger(num_verts_in))
+    {
+        if (!isInteger(R_edges_in)) error("R_edges_in should be integer");
+        int NE = asInteger(num_edges_in);
+        int* edges_in = INTEGER(R_edges_in);
+        for (int i = 0; i < NE ; i++, edges_in += 2) {
+            boost::add_edge(*edges_in, *(edges_in+1), 1, *this);
+        }
+    }
+};
+
+/* Graph_di is directed with integer weights
+   Graph_ui is undirected with integer weights
+   Graph_dd is directed with double weights
+   Graph_ud is undirected with double weights */
+
+typedef R_adjacency_list<boost::directedS, int> Graph_di;
+typedef R_adjacency_list<boost::undirectedS, int> Graph_ui;
+typedef R_adjacency_list<boost::directedS, double> Graph_dd;
+typedef R_adjacency_list<boost::undirectedS, double> Graph_ud;
+
+#endif // RBGL_RBGL_H
+
diff --git a/src/SUSPENDED/layout.cpp b/src/SUSPENDED/layout.cpp
new file mode 100644
index 0000000..c05c08d
--- /dev/null
+++ b/src/SUSPENDED/layout.cpp
@@ -0,0 +1,238 @@
+#include "RBGL.hpp"
+#include <boost/graph/circle_layout.hpp>
+#include <boost/graph/kamada_kawai_spring_layout.hpp>
+#include <boost/graph/random_layout.hpp>
+
+// Work-around:
+// the original .hpp simply does k*k/d (and the like) without checking d==0,
+// this is particularly troublesome when the given graph is disconnected
+#include "fruchterman_reingold.hpp"
+//#include <boost/graph/fruchterman_reingold.hpp>
+
+#include <boost/graph/gursoy_atun_layout.hpp>
+
+#include <boost/graph/simple_point.hpp>
+#include <boost/random/linear_congruential.hpp>
+
+using namespace boost;
+
+enum vertex_position_t { vertex_position };
+namespace boost { BOOST_INSTALL_PROPERTY(vertex, position); }
+
+struct point { double x, y; };
+
+typedef enum { E_LAYOUT_CIRCLE, 
+               E_LAYOUT_KKSL, 
+               E_LAYOUT_RANDOM, 
+               E_LAYOUT_FRFD, 
+               E_LAYOUT_GA } E_LAYOUT_METHOD;
+
+extern "C"
+{
+    typedef adjacency_list<vecS, vecS, undirectedS,
+    		// vertex properties
+    		property<vertex_index_t, int,
+    		property<vertex_position_t, simple_point<double> > >,
+    		// edge properties
+    		property<edge_weight_t, double> >
+    		IndexGraph;
+
+    SEXP BGL_layout_internal (E_LAYOUT_METHOD method, 
+         SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in, 
+         SEXP radius,
+         SEXP R_weights_in, SEXP edge_or_side, SEXP es_length,
+         SEXP R_minX, SEXP R_maxX, SEXP R_minY, SEXP R_maxY,
+         SEXP R_width, SEXP R_height
+         )
+    {
+        if (!isInteger(R_edges_in)) error("R_edges_in should be integer");
+
+        int NV = asInteger(num_verts_in);
+        int NE = asInteger(num_edges_in);
+        int* edges_in = INTEGER(R_edges_in);
+
+        IndexGraph g(NV);
+
+        for (int i = 0; i < NE ; i++, edges_in += 2)
+            boost::add_edge(*edges_in, *(edges_in+1), g);
+
+        if ( method == E_LAYOUT_CIRCLE )
+        {
+            double r = REAL(radius)[0];
+            circle_graph_layout(g, get(vertex_position, g), r);
+        }
+        else if ( method == E_LAYOUT_KKSL )
+        {
+            property_map<IndexGraph, vertex_position_t>::type 
+		    p = get(vertex_position, g);
+            property_map<IndexGraph, edge_weight_t>::type 
+		    w = get(edge_weight, g);
+
+            int* weight_i = (isReal(R_weights_in)) ? 0 : INTEGER(R_weights_in);
+            double* weight_d = (isReal(R_weights_in)) ? REAL(R_weights_in) : 0;
+
+            graph_traits< IndexGraph>::edge_iterator e, e_end;
+            for ( tie(e, e_end) = edges(g); e != e_end; ++e )
+                w[*e] = weight_i ? (*weight_i++) : (*weight_d++);
+
+            double l = REAL(es_length)[0];// * 50;
+            bool e_or_s = LOGICAL(edge_or_side)[0];
+
+            // what "radius" for call to circle_graph_layout?
+            circle_graph_layout(g, get(vertex_position, g), l);
+            bool ok;
+	    if ( e_or_s )
+		    ok = kamada_kawai_spring_layout(g, p, w, edge_length(l));
+	    else
+		    ok = kamada_kawai_spring_layout(g, p, w, side_length(l));
+        }
+        else if ( method == E_LAYOUT_RANDOM)
+        {
+            double minX = REAL(R_minX)[0];
+            double maxX = REAL(R_maxX)[0];
+            double minY = REAL(R_minY)[0];
+            double maxY = REAL(R_maxY)[0];
+    
+            property_map<IndexGraph, vertex_position_t>::type 
+		    p = get(vertex_position, g);
+
+            minstd_rand gen;
+            random_graph_layout(g, p, minX, maxX, minY, maxY, gen);
+        }
+        else if ( method == E_LAYOUT_FRFD)
+        {
+            double w = REAL(R_width)[0];
+            double h = REAL(R_height)[0];
+            
+            property_map<IndexGraph, vertex_position_t>::type 
+		    p = get(vertex_position, g);
+
+            minstd_rand gen;
+            random_graph_layout(g, p, -w/2, w/2, -h/2, h/2, gen);
+            fruchterman_reingold_force_directed_layout(g, p, w, h);
+        }
+        else if ( method == E_LAYOUT_GA )
+        {
+            double r = REAL(radius)[0];
+            double w = REAL(R_width)[0];
+            double h = REAL(R_height)[0];
+
+            property_map<IndexGraph, vertex_position_t>::type 
+		    p = get(vertex_position, g);
+
+            // TODO: fill in correct codes
+            //square_topology < > lst;
+            //gursoy_atun_layout(g, lst, p);
+        }
+        else
+        {
+        }
+
+        SEXP poslst;
+        PROTECT(poslst = allocMatrix(REALSXP,2, num_vertices(g)));
+
+        int i = 0;
+        property_map < IndexGraph, vertex_position_t >:: type
+        position = get(vertex_position, g);
+        graph_traits<IndexGraph>::vertex_iterator vi, vi_end;
+        for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+        {
+            REAL(poslst)[i++] = (double)position[*vi].x;
+            REAL(poslst)[i++] = (double)position[*vi].y;
+        }
+
+        UNPROTECT(1);
+        return(poslst);
+    }
+
+    SEXP BGL_circle_layout
+    (SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in, SEXP radius)
+    {
+        SEXP dummy_weights=0, dummy_e_or_s=0, dummy_es_length=0;
+        SEXP dummy_minX=0, dummy_maxX=0, dummy_minY=0, dummy_maxY=0;
+        SEXP dummy_width=0, dummy_height=0;
+
+        SEXP anslst; 
+        anslst = BGL_layout_internal(E_LAYOUT_CIRCLE, 
+                 num_verts_in, num_edges_in, R_edges_in, 
+                 radius, 
+                 dummy_weights, dummy_e_or_s, dummy_es_length,
+                 dummy_minX, dummy_maxX, dummy_minY, dummy_maxY,
+                 dummy_width, dummy_height);
+
+        return(anslst);
+    }
+
+    SEXP BGL_kamada_kawai_spring_layout
+    (SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in,
+     SEXP R_weights_in, SEXP edge_or_side, SEXP es_length)
+    {
+        SEXP dummy_radius=0;
+        SEXP dummy_minX=0, dummy_maxX=0, dummy_minY=0, dummy_maxY=0;
+        SEXP dummy_width=0, dummy_height=0;
+
+        SEXP anslst; 
+        anslst = BGL_layout_internal(E_LAYOUT_KKSL, 
+                 num_verts_in, num_edges_in, R_edges_in, 
+                 dummy_radius, 
+                 R_weights_in, edge_or_side, es_length,
+                 dummy_minX, dummy_maxX, dummy_minY, dummy_maxY,
+                 dummy_width, dummy_height);
+        return(anslst);
+    }
+
+    SEXP BGL_random_layout
+    (SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in, 
+     SEXP R_minX, SEXP R_maxX, SEXP R_minY, SEXP R_maxY)
+    {
+        SEXP dummy_radius=0; 
+        SEXP dummy_weights=0, dummy_e_or_s=0, dummy_es_length=0;
+        SEXP dummy_width=0, dummy_height=0;
+
+        SEXP anslst; 
+        anslst = BGL_layout_internal(E_LAYOUT_RANDOM, 
+                 num_verts_in, num_edges_in, R_edges_in, 
+                 dummy_radius, 
+                 dummy_weights, dummy_e_or_s, dummy_es_length,
+                 R_minX, R_maxX, R_minY, R_maxY,
+                 dummy_width, dummy_height);
+        return(anslst);
+    }
+
+    SEXP BGL_FRFD_layout
+    (SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in, 
+     SEXP R_width, SEXP R_height)
+    {
+        SEXP dummy_radius=0;
+        SEXP dummy_weights=0, dummy_e_or_s=0, dummy_es_length=0;
+        SEXP dummy_minX=0, dummy_maxX=0, dummy_minY=0, dummy_maxY=0;
+
+        SEXP anslst;
+        anslst = BGL_layout_internal(E_LAYOUT_FRFD,
+                 num_verts_in, num_edges_in, R_edges_in,
+                 dummy_radius,
+                 dummy_weights, dummy_e_or_s, dummy_es_length,
+                 dummy_minX, dummy_maxX, dummy_minY, dummy_maxY,
+                 R_width, R_height);
+        return(anslst);
+    }
+
+    SEXP BGL_gursov_atun_layout
+    (SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in, 
+     SEXP R_width, SEXP R_height, SEXP R_radius)
+    {
+        SEXP dummy_weights=0, dummy_e_or_s=0, dummy_es_length=0;
+        SEXP dummy_minX=0, dummy_maxX=0, dummy_minY=0, dummy_maxY=0;
+
+        SEXP anslst;
+        anslst = BGL_layout_internal(E_LAYOUT_FRFD,
+                 num_verts_in, num_edges_in, R_edges_in,
+                 R_radius,
+                 dummy_weights, dummy_e_or_s, dummy_es_length,
+                 dummy_minX, dummy_maxX, dummy_minY, dummy_maxY,
+                 R_width, R_height);
+        return(anslst);
+    }
+
+}
+
diff --git a/src/bbc.cpp b/src/bbc.cpp
new file mode 100644
index 0000000..09972e0
--- /dev/null
+++ b/src/bbc.cpp
@@ -0,0 +1,162 @@
+#include "RBGL.hpp"
+#include <boost/graph/betweenness_centrality.hpp>
+#include <boost/graph/bc_clustering.hpp>
+
+extern "C"
+{
+	using namespace boost;
+
+   	typedef adjacency_list<vecS, vecS, undirectedS,
+    		// vertex properties
+                property<vertex_index_t, int, 
+    		property<vertex_centrality_t, double> >, 
+    		// edge properties
+    		property<edge_weight_t, double, 
+    		property<edge_centrality_t, double> > >
+    		BCGraph;
+	typedef graph_traits<BCGraph>::edge_descriptor Edge;
+
+	SEXP BGL_brandes_betweenness_centrality(SEXP num_verts_in, 
+		SEXP num_edges_in, SEXP R_edges_in, SEXP R_weights_in)
+        {
+    		BCGraph g;
+
+		int NV = asInteger(num_verts_in);
+		int NE = asInteger(num_edges_in);
+		int* edges_in = INTEGER(R_edges_in);
+		double* weights_in = REAL(R_weights_in);
+
+		for (int i = 0; i < NE ; i++, edges_in += 2, weights_in++)
+		    boost::add_edge(*edges_in, *(edges_in+1), *weights_in, g);
+
+		SEXP anslst, bcvlst, enlst, bcelst, rbcvlst, dom;
+		PROTECT(anslst = allocVector(VECSXP,5));
+		PROTECT(bcvlst = allocMatrix(REALSXP, 1, NV));
+		PROTECT(enlst = allocMatrix(INTSXP, 2, NE));
+		PROTECT(bcelst = allocMatrix(REALSXP, 1, NE));
+		PROTECT(rbcvlst = allocMatrix(REALSXP, 1, NV));
+		PROTECT(dom = NEW_NUMERIC(1));
+
+		brandes_betweenness_centrality(g, 
+                        centrality_map(get(vertex_centrality, g)).
+			edge_centrality_map(get(edge_centrality, g)).
+			weight_map(get(edge_weight, g)));
+
+                property_map<BCGraph, vertex_centrality_t>::type 
+			v_map = get(vertex_centrality, g);
+                property_map<BCGraph, edge_centrality_t>::type 
+			e_map = get(edge_centrality, g);
+
+                graph_traits < BCGraph>::vertex_iterator vi, v_end;
+                graph_traits < BCGraph>::edge_iterator ei, e_end;
+
+                int v = 0, e = 0;
+
+		for ( tie(vi, v_end) = vertices(g); vi != v_end; vi++ ) 
+                    REAL(bcvlst)[v++] = v_map[*vi];
+		for ( v = 0, tie(ei, e_end) = edges(g); ei != e_end ; ei++ ) 
+		{
+		    INTEGER(enlst)[v++] = source(*ei, g);
+		    INTEGER(enlst)[v++] = target(*ei, g);
+                    REAL(bcelst)[e++] = e_map[*ei];
+                }
+
+		relative_betweenness_centrality(g, get(vertex_centrality, g));
+                v_map = get(vertex_centrality, g);
+
+		for ( v = 0, tie(vi, v_end) = vertices(g); vi != v_end; vi++ ) 
+                    REAL(rbcvlst)[v++] = v_map[*vi];
+		
+		double dominance = central_point_dominance(g,
+		                  get(vertex_centrality, g));
+
+		REAL(dom)[0] = dominance;
+
+		SET_VECTOR_ELT(anslst,0,bcvlst);
+		SET_VECTOR_ELT(anslst,1,bcelst);
+		SET_VECTOR_ELT(anslst,2,rbcvlst);
+		SET_VECTOR_ELT(anslst,3,dom);
+		SET_VECTOR_ELT(anslst,4,enlst);
+		UNPROTECT(6);
+		return(anslst);
+	}
+
+	class clustering_threshold : public bc_clustering_threshold<double>
+	{
+		typedef bc_clustering_threshold<double> inherited;
+
+	public:
+	        clustering_threshold(double threshold, const BCGraph& g, bool normalize)
+		: inherited(threshold, g, normalize), iter(1) { }
+
+	        bool operator()(double max_centrality, Edge e, const BCGraph& g)
+	        {
+#if DEBUG
+                  std::cout << "Iter: " << iter << " Max Centrality: "
+                       << (max_centrality / dividend) << std::endl;
+#endif
+		  ++iter;
+		  return inherited::operator()(max_centrality, e, g);
+	        }
+
+	private:
+		 unsigned int iter;
+	};
+
+	SEXP BGL_betweenness_centrality_clustering (SEXP num_verts_in, 
+		SEXP num_edges_in, SEXP R_edges_in, SEXP R_weights_in,
+		SEXP R_threshold,  SEXP R_normalize)
+        {
+    		BCGraph g;
+
+		int NE = asInteger(num_edges_in);
+		int* edges_in = INTEGER(R_edges_in);
+		double* weights_in = REAL(R_weights_in);
+
+		for (int i = 0; i < NE ; i++, edges_in += 2, weights_in++)
+		    boost::add_edge(*edges_in, *(edges_in+1), *weights_in, g);
+
+		double threshold = REAL(R_threshold)[0];
+		bool normalize = LOGICAL(R_normalize)[0];
+
+		betweenness_centrality_clustering(g,
+			clustering_threshold(threshold, g, normalize),
+			get(edge_centrality, g));
+
+		SEXP anslst, cnt, bcvlst, bcelst;
+		PROTECT(anslst = allocVector(VECSXP,3));
+		PROTECT(cnt = NEW_INTEGER(1));
+		PROTECT(bcvlst = allocMatrix(INTSXP, 2, num_edges(g)));
+		PROTECT(bcelst = allocMatrix(REALSXP, 1, num_edges(g)));
+
+		INTEGER(cnt)[0] = num_edges(g);
+
+		property_map < BCGraph, edge_centrality_t >::type
+		         ec = get(edge_centrality, g);
+
+		typedef graph_traits<BCGraph>::edge_iterator   edge_iterator;
+		edge_iterator ei, e_end;
+
+#if DEBUG
+                std::cout << " edge centralities: ";
+		for ( tie(ei, e_end) = edges(g); ei != e_end; ++ei )
+                        std::cout << " " << ec[*ei];
+                std::cout << std::endl;
+#endif
+
+		int i = 0, j = 0;
+		for ( tie(ei, e_end) = edges(g); ei != e_end; ++ei )
+		{
+			INTEGER(bcvlst)[i++] = source(*ei, g);
+			INTEGER(bcvlst)[i++] = target(*ei, g);
+			REAL(bcelst)[j++] = ec[*ei];
+		}
+
+		SET_VECTOR_ELT(anslst,0,cnt);
+		SET_VECTOR_ELT(anslst,1,bcvlst);
+		SET_VECTOR_ELT(anslst,2,bcelst);
+		UNPROTECT(4);
+		return(anslst);
+	}
+}
+
diff --git a/src/cliques.cpp b/src/cliques.cpp
new file mode 100644
index 0000000..049053c
--- /dev/null
+++ b/src/cliques.cpp
@@ -0,0 +1,304 @@
+#include "RBGL.hpp"
+
+extern "C"
+{
+    using namespace boost;
+    using namespace std;
+
+    // Combinatorial Optimization: algorithms and complexity  (p. 403)
+    // by C. H. Papadimitriou, K. Steiglitz
+    //
+    // A graph G = (V, E) is triangulated (i.e. chordal) if all cycles
+    // [v1, v2, ..., vk] of length 4 or more have an chord, i.e., an edge
+    // [vi, vj] with j != i +/- 1 (mod k)
+    //
+    // an equivalent definition of chordal graphs is:
+    //
+    // G is chordal iff either G is an empty graph, or
+    // there is an v in V such that
+    //     (i) the neighborhood of v (i.e., v and its adjacent nodes)
+    //         forms a clique, and
+    //     (ii) recursively, G-v is chordal
+
+    static bool isClique(Graph_ud& g, graph_traits < Graph_ud >::vertex_descriptor v)
+    {
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        std::pair<Edge, bool> pp;
+
+        Graph_ud::adjacency_iterator va, va_last, va1, va2;
+
+        tie(va, va_last) = adjacent_vertices(v, g);
+
+
+#if DEBUG
+        cout << " no. nodes = " << num_vertices(g)
+        << " no. edges = " << num_edges(g)
+        << endl;
+        cout << " connected nodes:   ";
+        for ( va1 = va; va1 != va_last; va1++ )
+        {
+            cout << *va1+1 << "  ";
+        }
+        cout << endl;
+#endif
+
+        for ( va1 = va; va1 != va_last; va1++ )
+        {
+            va2 = va1;
+            for ( va2 = va1+1; va2 != va_last; va2++ )
+            {
+#if DEBUG
+                cout << "    " << *va1+1 << "--" << *va2+1 << endl;
+#endif
+                pp = edge(*va1, *va2, g);
+                if ( !pp.second ) return FALSE;
+            }
+        }
+
+        return TRUE;
+    }
+
+    static bool isTriangulatedInternal(Graph_ud& g)
+    {
+        bool r = TRUE;
+
+        typedef graph_traits < Graph_ud >::vertex_iterator vertex_iterator;
+
+        vertex_iterator vi, vi_end;
+        Graph_ud::adjacency_iterator va, va_last;
+
+        if ( num_edges(g) == 0 && num_vertices(g) == 0 )
+            return TRUE;
+
+        for ( tie(vi, vi_end) = vertices(g); vi != vi_end; vi++ )
+        {
+#if DEBUG
+            cout << *vi+1 << endl;
+#endif
+            if ( isClique(g, *vi) )
+            {
+#if DEBUG
+                cout << "         REMOVED " << endl;
+#endif
+                clear_vertex(*vi, g);
+                remove_vertex(*vi, g);
+                r = isTriangulatedInternal(g);
+                return r;
+            }
+        }
+        return FALSE;
+    }
+
+    SEXP isTriangulated(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in )
+    {
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+        SEXP ans;
+        PROTECT(ans = NEW_INTEGER(1));
+
+        INTEGER(ans)[0] = isTriangulatedInternal(g);
+
+        UNPROTECT(1);
+        return(ans);
+    }
+
+typedef vector<int>              oneCliqueType;
+typedef vector<oneCliqueType>    allCliquesType;
+
+#if DEBUG
+    static void print_one_clique(oneCliqueType& clique)
+    {
+        cout << "     clique contains node(s): ";
+        for ( unsigned int j = 0; j < clique.size(); j++ )
+            cout << clique[j]+1 << "  "; 
+        cout << endl;
+    }
+
+    static void print_all_cliques(allCliquesType& cliques, char* msg)
+    {
+        cout << msg << endl;
+        for ( unsigned int i = 0; i < cliques.size(); i++ )
+            print_one_clique(cliques[i]);
+    }
+#endif
+
+    static bool inline isConnected(Graph_ud& g, int u, int v)
+    {
+        if ( u == v ) return TRUE;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        std::pair<Edge, bool> p;
+        p = edge(u, v, g);
+        return p.second;
+    }
+
+    static void extend_v2(Graph_ud& g, std::vector<int>& old_array, 
+                          std::vector<int>& compsub,
+                          int ne, int ce, int& c, 
+                          allCliquesType& cliques)
+    {
+        std::vector<int> new_array(ce+1);    
+        int nod, fixp;
+        int newne, newce, i, j, count, pos, p, s, sel, minnod;
+        minnod = ce;
+        nod = 0;
+        fixp = -1;
+        pos = -1;
+        s = -1;
+
+        // determine each counter value and look for minimum
+        for ( i = 1; i <= ce && minnod != 0; i++ )
+        {
+            p = old_array[i]; count = 0;
+
+            // count disconnections
+            for ( j = ne+1; j <= ce && count < minnod; j++ )
+            {
+                if ( !isConnected(g, p, old_array[j]) )
+                {
+                    count++;
+                    pos = j;  // position of potential candidate
+                }
+            }
+
+            // test new minimum
+            if ( count < minnod )
+            {
+                fixp = p;
+                minnod = count;
+                if ( i <= ne ) { s = pos; }
+                else { s = i; nod = 1; }
+            }
+        }
+
+        // backtrack cycle
+        if ( s <= ce )         // just to play it safe
+        for ( nod = minnod + nod; nod >= 1; nod-- )
+        {
+            // interchange
+            p = old_array[s];
+            old_array[s] = old_array[ne+1];
+            old_array[ne+1] = p;
+            sel = p;
+
+            newne = 0;
+
+            // fill new set "not_set"
+            for ( i = 1; i <= ne; i++ )
+            {
+                if ( isConnected(g, sel, old_array[i]) )
+                    new_array[++newne] = old_array[i];
+            }
+
+            // fill new set "cand"
+            newce = newne; 
+            for ( i = ne+2; i <= ce; i++ )
+            {
+                if ( isConnected(g, sel, old_array[i]) )
+                    new_array[++newce] = old_array[i];
+            }
+
+            c++;
+            compsub[c] = sel;
+            if ( newce == 0 )
+            {
+                oneCliqueType clique(c);
+                for ( int loc = 1; loc <= c; loc++ )
+                {
+                    clique[loc-1] = compsub[loc];
+                }
+                cliques.push_back(clique);
+
+#if DEBUG
+                cout << "   found ";
+                print_one_clique(clique);
+#endif
+            }
+            else
+            {
+                if ( newne < newce )
+                    extend_v2(g, new_array, compsub, newne, newce, c, cliques);
+            }
+
+            // remove from "compsub"
+            c--;
+
+            // add to "not_set"
+            ne++;
+            // select a condidate disconnected to the fixed point
+            if ( nod > 1 )
+            {
+                // look for candidate
+                for ( s = ne+1; s <= ce && isConnected(g, fixp, old_array[s]); s++ )
+                    ;
+            }
+
+        }
+    }
+
+    static void bron_kerbosch_all_cliques(Graph_ud& g, allCliquesType& cliques)
+    {
+        int N = num_vertices(g);
+
+        std::vector<int> ALL(N+1);
+        std::vector<int> compsub(N+1, 0);
+
+        for ( int i = 0; i <= N; i++ ) ALL[i] = i-1;  // node index for BGL graph
+
+        int c = 0;
+        extend_v2(g, ALL, compsub, 0, N, c, cliques);
+
+#if DEBUG
+        print_all_cliques(cliques, " all cliques: ");
+#endif
+    }
+
+    SEXP maxClique(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in )
+    {
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+        allCliquesType cliques;
+
+        bron_kerbosch_all_cliques(g, cliques);
+
+        allCliquesType::iterator ci;
+
+/*
+        // keep only the max cliques
+        int max_clique_size = 0;
+        for ( ci = cliques.begin(); ci != cliques.end(); ci++ )
+        {
+            if ( (*ci).size() > max_clique_size )
+               max_clique_size = (*ci).size();
+        }
+
+        for ( ci--; ci != cliques.begin(); ci-- )
+            if ( (*ci).size() < max_clique_size )
+               cliques.erase(ci);
+*/
+
+#if DEBUG
+        print_all_cliques(cliques, " max clique(s): ");
+#endif
+
+        oneCliqueType::iterator cj;
+
+        int i, j;
+        SEXP ansList, cnodes;
+        PROTECT(ansList = allocVector(VECSXP, cliques.size()));
+
+        for ( i = 0, ci = cliques.begin(); ci != cliques.end(); i++, ci++ )
+        {
+            PROTECT(cnodes = allocVector(INTSXP, (*ci).size()));
+
+            for ( j = 0, cj = (*ci).begin(); cj != (*ci).end(); j++, cj++ )
+                INTEGER(cnodes)[j] = *cj+1;    // node index for R graph
+
+            SET_VECTOR_ELT(ansList,i,cnodes);
+            UNPROTECT(1);
+        }
+
+        UNPROTECT(1);
+        return(ansList);
+    }
+}
+
diff --git a/src/clusteringCoef.cpp b/src/clusteringCoef.cpp
new file mode 100644
index 0000000..d4d9f46
--- /dev/null
+++ b/src/clusteringCoef.cpp
@@ -0,0 +1,458 @@
+#include "RBGL.hpp"
+
+#include <stdlib.h>
+
+#include <boost/graph/simple_point.hpp>
+
+extern "C"
+{
+
+#include <Rdefines.h>
+#include <R_ext/Random.h>
+#include <Rmath.h>
+
+    using namespace std;
+    using namespace boost;
+
+    static void delta_and_tau
+     (const Graph_ud& g, vector<int>& v_delta, vector<int>& v_tau)
+    {
+        Graph_ud::vertex_iterator vi, v_end;
+        Graph_ud::adjacency_iterator ui, u_end, wi, w_end;
+
+        int dv = 0, tv = 0;
+
+        v_delta.clear();
+        v_tau.clear();
+
+        for ( tie(vi, v_end) = vertices(g); vi != v_end; ++vi )
+        {
+            // delta(v)
+            dv = 0;
+            for ( tie(ui, u_end) = adjacent_vertices(*vi, g);
+                    ui != u_end; ++ui )
+            {
+                wi = ui;
+                for ( ++wi; wi != u_end; ++wi )
+                    if ( edge(*ui, *wi, g).second ) dv++;
+            }
+            v_delta.push_back(dv);
+
+            // tau(v)
+            dv = degree(*vi, g);
+            tv = dv * ( dv - 1 ) / 2;
+            v_tau.push_back(tv);
+        }
+    }
+
+    SEXP clusteringCoef(
+        SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in,
+        SEXP weighted, SEXP R_v_weights_in)
+    {
+        int i;
+
+        int NV = INTEGER(num_verts_in)[0];
+        vector<double> v_weight(NV, 1);
+
+        if ( INTEGER(weighted)[0] )
+        {
+            double* weights = REAL(R_v_weights_in);
+            for ( i = 0; i < NV; i++ ) v_weight[i] = weights[i];
+        }
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+        vector<int> v_delta, v_tau;
+        delta_and_tau(g, v_delta, v_tau);
+
+        double nn = 0;		// count nodes w/ deg(v) >= 2
+        double cG = 0;
+	Graph_ud::vertex_descriptor v;
+        for ( i = 0; i < NV; i++ )
+        {
+	    v = vertex(i, g);
+            if ( out_degree(v, g) >= 2 && v_tau[i] > 0 )
+            {
+                cG += v_weight[i] * v_delta[i] / v_tau[i];
+                nn += v_weight[i];
+            }
+        }
+
+        if ( nn ) cG /= nn;
+
+        SEXP ccoef;
+        PROTECT(ccoef = NEW_NUMERIC(1));
+        REAL(ccoef)[0] = cG;
+        UNPROTECT(1);
+        return(ccoef);
+    }
+
+    SEXP transitivity( SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in)
+    {
+        int NV = INTEGER(num_verts_in)[0];
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+        vector<int> v_delta, v_tau;
+        delta_and_tau(g, v_delta, v_tau);
+
+	double tG = 0;
+        double sum_dv = 0, sum_tv = 0;
+        for ( int i = 0; i < NV; i++ )
+        {
+            sum_dv += v_delta[i];
+            sum_tv += v_tau[i];
+        }
+        if ( sum_tv ) tG = sum_dv / sum_tv;
+
+#if DEBUG
+        cout << " sum_dv = " << sum_dv
+        << " sum_tv = " << sum_tv
+        << " v_delta.size() = " << v_delta.size()
+        << " v_tau.size() = " << v_tau.size()
+	<< " tG = " << tG
+        << endl;
+#endif
+
+        SEXP tcoef;
+        PROTECT(tcoef = NEW_NUMERIC(1));
+        REAL(tcoef)[0] = tG;
+        UNPROTECT(1);
+        return(tcoef);
+    }
+
+    // uniformly sample in [1, n]
+    static inline int uniformRandomNumber(const int n)
+    {
+	int j = (int)(n * unif_rand()) + 1;   // unif_rand in [0, 1)
+	return j;
+    }
+
+    static inline int findIndex(const int r, const vector<int>& W)
+    {
+	unsigned int i;
+	for ( i = 1; i < W.size(); i++ ) if ( r <= W[i] ) break;
+	return i;
+    }
+
+    // input: a node in graph g
+    // output: one neighbor of node n chosen uniformly randomly
+    static inline void uniformRandomAdjacentNode
+	(const Graph_ud::vertex_descriptor& v, const Graph_ud& g, 
+	 Graph_ud::vertex_descriptor& u,
+	 Graph_ud::vertex_descriptor& w)
+    {
+	int nc = out_degree(v, g);
+
+	Graph_ud::adjacency_iterator vi, v_end;
+	tie(vi, v_end) = adjacent_vertices(v, g);
+
+	switch (nc)
+	{
+	case 0: 
+	case 1: u = w = *vi;
+		break;
+	case 2: 
+		u = *vi; vi++;
+		w = *vi; 
+		break;
+	default:
+		{
+		int r1 = uniformRandomNumber(nc);
+		int r2 = uniformRandomNumber(nc);
+
+		while ( r1 == r2 ) r2 = uniformRandomNumber(nc);
+
+		for ( int i = 0; vi != v_end; vi++, i++ )
+		{
+		    if ( i == r1 ) u = *vi;
+		    if ( i == r2 ) w = *vi;
+		}
+
+		break;
+		}
+	}
+#if DEBUG
+	cout << " uniformRandomAdjacentNode: " << endl;
+	cout << " n = " << n << endl;
+	cout << " nc = " << nc << endl;
+	cout << " *vi = " << *vi << endl;
+	cout << " u = " << u << endl;
+	cout << " w = " << w << endl;
+#endif
+    }
+
+    static inline void uniformRandomAdjacentNode_i
+	(const int n, const Graph_ud& g, 
+	 Graph_ud::vertex_descriptor& u,
+	 Graph_ud::vertex_descriptor& w)
+    {
+	Graph_ud::vertex_descriptor v = vertex(n, g);
+	uniformRandomAdjacentNode(v, g, u, w);
+    }
+
+    // Approximating Cw  
+    //    Outline of the algorithm:
+    //    Input: integer k; 
+    //           array A[1..|V'|] of nodes V' = {v in V: d(v) >= 2}
+    //           node weights w: V' -> N>0;
+    //           adjacentcy array for each node
+    //    Output: approximation of Cw
+    //    Data: node variables: u, w;
+    //           integer variables: r, l, j, W[0..|V'|]
+    //    Algorithm:
+    //    W[0] = 0
+    //    for i = (1, ..., |V'|) do
+    //       W[i] = W[i-1] + w(A[i])
+    //    l = 0
+    //    for i in (1, ..., k) do
+    //    {
+    //       r = UniformRandomNumber( {1,...,W[|V'|]} )
+    //       j = FindIndex( j: W[j-1] < r <= W[j] )
+    //       u = UniformRandomAdjacentNode(A[j])
+    //       repeat
+    //         w = UniformRandomAdjacentNode(A[j])
+    //       until u != w
+    //       if ( EdgeExists(u, w) then
+    //          l = l + 1
+    //    }
+    //    return l/k
+
+    SEXP clusteringCoefAppr(SEXP k_in,
+        SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in,
+        SEXP weighted, SEXP R_v_weights_in)
+    {
+	// prepare for later unif_rand call
+	GetRNGstate();
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+        int i, l, r, j;
+
+        int k = INTEGER(k_in)[0];
+        int NV = INTEGER(num_verts_in)[0];
+        vector<int> v_weight(NV, 1);
+        vector<int> W(NV+1, 0);
+
+#if DEBUG
+	cout << " inside clusteringCoefAppr " 
+		<< " k = " << k
+		<< " NV = " << NV 
+		<< endl;
+#endif
+
+        if ( INTEGER(weighted)[0] )
+        {
+            double* weights = REAL(R_v_weights_in);
+            for ( i = 0; i < NV; i++ ) v_weight[i] = (int) weights[i];
+        }
+
+        Graph_ud::vertex_descriptor u=Graph_ud::null_vertex(), w=Graph_ud::null_vertex();
+
+	W[0] = 0;
+	for ( i = 1; i < NV+1; i++ ) W[i] = W[i-1] + v_weight[i-1];
+
+	// TODO: limit nodes to those w/ degree >= 2
+	//       pick a number within range uniformaly 
+	//	 pick an adjacent node uniformaly randomly
+	for ( l = 0, i = 0; i < k; i++ )
+	{
+	   r = uniformRandomNumber(W[NV]);
+	   j = findIndex(r, W);
+	   uniformRandomAdjacentNode_i(j-1, g, u, w);
+
+	   if ( edge(u, w, g).second ) l++;
+
+#if DEBUG
+	   cout << " i = " << i;
+	   cout << " r = " << r;
+	   cout << " j = " << j;
+	   cout << " l = " << l << endl;
+#endif
+	}
+
+	double cG = double(l) / double(k);
+
+        SEXP ccoef;
+        PROTECT(ccoef = NEW_NUMERIC(1));
+        REAL(ccoef)[0] = cG;
+        UNPROTECT(1);
+        return(ccoef);
+
+    }
+
+    inline bool prob_cmp(const simple_point<int>& p1, 
+			 const simple_point<int>& p2)
+	{ return p1.y > p2.y; }
+
+    //  To find a random node w/ probability d(u) / sum(d(V))
+    //  The following closely mirrors the codes on
+    //  Unequal probability sampling; without-replacement case
+    //
+    //    /* Record element identities */
+    //    for (i = 0; i < n; i++)
+    //        perm[i] = i + 1;
+    //
+    //    //* Sort probabilities into descending order */
+    //    //* Order element identities in parallel */
+    //    revsort(p, perm, n);
+    //
+    //    //* Compute the sample */
+    //    totalmass = 1;
+    //    for (i = 0, n1 = n-1; i < nans; i++, n1--) {
+    //        rT = totalmass * unif_rand();
+    //        mass = 0;
+    //        for (j = 0; j < n1; j++) {
+    //            mass += p[j];
+    //            if (rT <= mass)
+    //                break;
+    //        }
+    //        ans[i] = perm[j];
+    //        totalmass -= p[j];
+    //        for(k = j; k < n1; k++) {
+    //            p[k] = p[k + 1];
+    //            perm[k] = perm[k + 1];
+    //        }
+    //    }
+    static void ProbRandomNode
+	(const Graph_ud::vertex_descriptor& v, const Graph_ud& g,
+	 Graph_ud::vertex_descriptor& u)
+    {
+
+	typedef graph_traits<Graph_ud>::vertex_iterator vertex_iterator;
+
+	vertex_iterator vi, v_end;
+
+	int NV = num_vertices(g);
+	std::vector < simple_point<int> > pp(num_vertices(g));
+
+	int i = 0, totalmass = 0;
+	for ( tie(vi, v_end) = vertices(g); vi != v_end; vi++, i++ )
+	{
+	   pp[i].x = i+1;
+	   pp[i].y = out_degree(*vi, g);
+	   totalmass += pp[i].y;
+	}
+
+	std::stable_sort(pp.begin(), pp.end(), prob_cmp);
+
+	int j, k, n1, rT, mass;
+	for ( i = 0, n1 = NV-1; i < NV; i++, n1-- )
+	{
+            rT = (int)(totalmass * unif_rand());
+            mass = 0;
+            for (j = 0; j < n1; j++) {
+                mass += pp[j].y;
+                if (rT <= mass) break;
+            }
+	    u = vertex(i, g);
+	    if ( !edge(v, u, g).second ) break;
+
+	    totalmass -= pp[j].y;
+	    for ( k = j; k < n1; k++ ) pp[k] = pp[k+1];
+	}
+    }
+
+    // Graph Generator:
+    //    Outline of algorithm:
+    //    Input: initial graph G: two connected nodes
+    //           integer: n >= 3, d >= 2, o
+    //    Output: graph G
+    //    Algorithm:
+    //    for ( i = (3, ..., n) do
+    //    {
+    //       v = NewNode()
+    //       for 1, ..., Min(i-1, d) do
+    //       {
+    //          repeat 
+    //            u = RandomNode( with prob du / sum(d(v) )
+    //          until node EdgeExists(v, u)
+    //          AddEdge(v, u)
+    //       }
+    //       for 1, ..., o do
+    //       {
+    //          u = RandomAdjacentNode(v)
+    //          repeat
+    //             w = RandomAdjacentNode(v)
+    //          until w != u
+    //          if ( node EdgeExists(u, w) then
+    //             AddEdge(u, w)
+    //       }
+    //    }
+
+    SEXP graphGenerator(SEXP n_in, SEXP d_in, SEXP o_in)
+    {
+	int i, j;
+        int n = INTEGER(n_in)[0];
+        int d = INTEGER(d_in)[0];
+        int o = INTEGER(o_in)[0];
+
+	GetRNGstate();	// get random number generator ready
+
+	// initial graph with 2 connected nodes
+	Graph_ud g(2);
+	boost::add_edge(0, 1, g);
+
+        Graph_ud::vertex_descriptor v, u, w=Graph_ud::null_vertex();
+	
+	for ( i = 3; i <= n; i++ )
+	{
+	   // generate a new node 
+	   v = boost::add_vertex(g);
+
+	   for ( j = 1; j <= min(i-1, d); j++ )
+	   {
+		ProbRandomNode(v, g, u); 
+		boost::add_edge(v, u, g);
+	   }
+
+	   for ( j = 1; j <= o; j++ )
+	   {
+	        uniformRandomAdjacentNode(v, g, u, w);
+
+		if ( !edge(u, w, g).second )
+		   boost::add_edge(u, w, g);
+	   }
+	}
+
+#if DEBUG
+	typedef graph_traits<Graph_ud>::vertex_iterator vertex_iterator;
+	vertex_iterator vi, v_end;
+	cout << " no. of vertices: " << num_vertices(g)
+	     << " no. of edges:    " << num_edges(g)
+	     << endl;
+
+	for ( tie(vi, v_end) = vertices(g); vi != v_end; vi++, i++ )
+	{
+	   cout << " vertex: " << *vi 
+		<< " has degree: " << out_degree(*vi, g)
+		<< endl;
+	}
+#endif
+
+        int NE = num_edges(g);
+        SEXP anslst, ncnt, ecnt, enlst;
+        PROTECT(anslst = allocVector(VECSXP, 3));
+        PROTECT(ncnt = NEW_INTEGER(1));
+        PROTECT(ecnt = NEW_INTEGER(1));
+        PROTECT(enlst = allocMatrix(INTSXP, 2, NE));
+
+        INTEGER(ncnt)[0] = num_vertices(g);
+        INTEGER(ecnt)[0] = NE;
+
+	typedef graph_traits<Graph_ud>::edge_iterator edge_iterator;
+	edge_iterator ei, e_end;
+	for ( i = 0, tie(ei, e_end) = edges(g); ei != e_end ; ei++ )
+        {
+            INTEGER(enlst)[i++] = source(*ei, g);
+            INTEGER(enlst)[i++] = target(*ei, g);
+        }
+
+
+	SET_VECTOR_ELT(anslst,0,ncnt);
+	SET_VECTOR_ELT(anslst,1,ecnt);
+        SET_VECTOR_ELT(anslst,2,enlst);
+        UNPROTECT(4);
+        return(anslst);
+    }
+
+}
+
diff --git a/src/dominatorTree.cpp b/src/dominatorTree.cpp
new file mode 100644
index 0000000..674e782
--- /dev/null
+++ b/src/dominatorTree.cpp
@@ -0,0 +1,66 @@
+#include "RBGL.hpp"
+#include <boost/graph/dominator_tree.hpp>
+
+extern "C"
+{
+    SEXP BGL_dominator_tree(SEXP num_verts_in, SEXP num_edges_in, 
+         SEXP R_edges_in, SEXP start )
+    {
+    	using namespace std;
+    	using namespace boost;
+
+        const int NV = asInteger(num_verts_in);
+        const int NE = asInteger(num_edges_in);
+        int v = asInteger(start);
+
+        typedef adjacency_list < vecS, listS, bidirectionalS,
+                        property < vertex_index_t, int> > VEGraph;
+
+         VEGraph g(NV);
+
+         typedef property_map < VEGraph, vertex_index_t > ::type IndexMap;
+         IndexMap v1_index_map = get(vertex_index, g);
+         vector<graph_traits<VEGraph>::vertex_descriptor> v1(NV);
+         graph_traits<VEGraph>::vertex_iterator vi, v_end;
+         int i = 0;
+         for (tie(vi, v_end) = vertices(g); vi != v_end; ++vi, ++i)
+         {
+               put(v1_index_map, *vi, i);
+               v1[i] = *vi;
+         }
+
+         int* edges_in = INTEGER(R_edges_in);
+         for ( i = 0; i < NE; i++, edges_in += 2 )
+         {
+             add_edge(v1[*edges_in], v1[*(edges_in+1)], g);
+         }
+
+        typedef graph_traits < VEGraph > ::vertex_descriptor Vertex;
+
+        vector< Vertex > domTreePredVector =
+            vector<Vertex>(num_vertices(g), graph_traits<VEGraph>::null_vertex());
+        iterator_property_map< vector < Vertex > ::iterator, IndexMap > 
+          domTreePredMap =
+             make_iterator_property_map(domTreePredVector.begin(), v1_index_map);
+
+    	lengauer_tarjan_dominator_tree(g, vertex(v, g), domTreePredMap);
+
+        SEXP ansList;
+        PROTECT(ansList = allocVector(INTSXP,num_vertices(g)));
+
+        for (tie(vi, v_end) = vertices(g); vi != v_end; ++vi)
+	{
+            i = get(v1_index_map, *vi);
+            if (get(domTreePredMap, *vi) != graph_traits<VEGraph>::null_vertex())
+		INTEGER(ansList)[i] = get(v1_index_map, get(domTreePredMap, *vi));
+            else
+                INTEGER(ansList)[i] = i; // (numeric_limits<int>::max)();
+	}
+
+        UNPROTECT(1);
+        return(ansList);
+
+    }
+
+}
+
diff --git a/src/edmonds_optimum_branching.cpp b/src/edmonds_optimum_branching.cpp
new file mode 100644
index 0000000..1b6d063
--- /dev/null
+++ b/src/edmonds_optimum_branching.cpp
@@ -0,0 +1,73 @@
+#include "RBGL.hpp"
+
+#include "edmonds_optimum_branching.hpp"
+
+extern "C"
+{  
+
+    SEXP edmondsOptimumBranching(SEXP num_verts_in,
+                SEXP num_edges_in, SEXP R_edges_in, SEXP R_weights_in )
+    {
+
+        using namespace boost;
+
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        property_map<Graph_dd, boost::edge_weight_t>::type 
+		weights = get(edge_weight, g);
+
+	property_map<Graph_dd, boost::vertex_index_t>::type 
+		vertex_indices = get(vertex_index, g);
+
+   typedef graph_traits<Graph_dd>::vertex_descriptor       Vertex;
+   typedef graph_traits<Graph_dd>::edge_descriptor         Edge;
+
+#ifdef RBGL_DEBUG
+    std::cout << "This is the graph:\n";
+    BOOST_FOREACH (Edge e, edges(g))
+    {
+        std::cout << "(" << source(e, g) << ", "
+                  << target(e, g) << ")\t"
+                  << get(weights, e) << "\n";
+    }
+#endif
+
+	std::vector<Edge> branching;
+	edmonds_optimum_branching<true, false, false>(g,
+                                  vertex_indices,
+                                  weights,
+                                  static_cast<Vertex *>(0),
+                                  static_cast<Vertex *>(0),
+                                  std::back_inserter(branching));
+
+#ifdef RBGL_DEBUG
+    std::cout << "This is the maximum branching\n";
+    BOOST_FOREACH (Edge e, branching)
+    {
+        std::cout << "(" << source(e, g) << ", "
+                  << target(e, g) << ")\t"
+                  << get(weights, e) << "\n";
+    }
+#endif
+
+        SEXP ansList, ans, answt;
+	PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(ans = allocMatrix(INTSXP, 2, branching.size()));
+	PROTECT(answt = allocMatrix(REALSXP,1,branching.size()));
+
+        int k = 0, j = 0;
+	BOOST_FOREACH (Edge e, branching)
+    	{
+	    INTEGER(ans)[k++] = source(e, g);
+	    INTEGER(ans)[k++] = target(e, g);
+	    REAL(answt)[j++] = get(weights, e);
+	}
+
+	SET_VECTOR_ELT(ansList,0,ans);
+	SET_VECTOR_ELT(ansList,1,answt);
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+}
+
diff --git a/src/edmonds_optimum_branching.hpp b/src/edmonds_optimum_branching.hpp
new file mode 100644
index 0000000..99b0fef
--- /dev/null
+++ b/src/edmonds_optimum_branching.hpp
@@ -0,0 +1,96 @@
+//
+// See Edmonds' Algorithm on http://edmonds-alg.sourceforge.net.
+//
+
+#ifndef EDMONDS_OPTIMUM_BRANCHING_HPP
+#define EDMONDS_OPTIMUM_BRANCHING_HPP
+
+// edmonds_optimum_branching()
+//
+// This template function implements Tarjan's implementation of
+// Edmonds's algorithm for finding optimum branchings. The function
+// uses concepts from the Boost graph library. The template parameters
+// have the following definition:
+//
+// TOptimumIsMaximum: if true then the algorithm finds a branching of
+// maximum weight. If false, the algorithm finds a branching with
+// minimum weight.
+//
+// TAttemptToSpan: if true, the algorithm attempts to span the entire
+// graph. If root vertices have been assigned by the caller (see
+// description of roots_begin and roots_end) and at least one
+// branching exists whose only roots are those specified, then the
+// algorithm finds an optimum branching whose roots are exactly those
+// specified. If no roots have been specified by the caller and at
+// least one branching exists with exactly one root, then the
+// algorithm finds an optimum branching with exactly one root.  If the
+// parameter is false, an optimum branching is returned that may not
+// span the entire graph. For example, no edge that worsens the cost
+// of the branching is included.
+//
+// TGraphIsDense: if true, the algorithm will have time complexity
+// O(n^2) where n is the number of vertices of the graph. If false,
+// the algorithm will have time complexity O(m log n) where n is the
+// number of vertices and m is the number of edges of the
+// graph. NOTE!!! currently, this parameter has no effect as the
+// function is only implemented for dense graphs.
+//
+// TEdgeListGraph: the type of the graph that adheres to the
+// EdgeListGraph concept of the Boost Graph Library.
+//
+// TVertexIndexMap: the type of the Boost property map that maps the
+// vertices of the graph to non-negative integers.
+//
+// TWeightMap: the type of the Boost property map that associates
+// weights with each edge of the graph. Note that the weights must be
+// of a numeric type that supports the operations of +, -, <, >.
+//
+// TInputIterator: the type of iterator used for traversing
+// vertices. The type must adhere to the Input Iterator concept of the STL.
+//
+// TOutputIterator: the type of iterator used for outputting the edges
+// of the branching. The type must adhere to the Output Iterator
+// concept of the STL.
+//
+// The input to the graph is as follows:
+//
+// g is the graph that adheres to the EdgeListGraph concept of the
+// Boost Graph Library.
+//
+// index is a Boost property map that maps each vertex of g to a
+// positive integer. If g contains n vertices, then index must map
+// each vertex uniquely to an integer in the range 0..n-1. Constant
+// time complexity is required.
+//
+// weight is a Boost property map associating a weight with each edge
+// of g. Constant time complexity is required.
+//
+// roots_begin and roots_end are iterators over vertices of g. Any
+// vertices in this range are guaranteed to be roots in the final
+// branching. This range may of course be empty, in which case
+// appropriate roots are found by the algorithm.
+//
+// out is an output iterator to which the edges of the optimum
+// branching is written.
+// 
+template <bool TOptimumIsMaximum,
+          bool TAttemptToSpan,
+          bool TGraphIsDense,
+          class TEdgeListGraph,
+          class TVertexIndexMap,
+          class TWeightMap,
+          class TInputIterator,
+          class TOutputIterator>
+void
+edmonds_optimum_branching(TEdgeListGraph &g,
+                          TVertexIndexMap index,
+                          TWeightMap weight,
+                          TInputIterator roots_begin,
+                          TInputIterator roots_end,
+                          TOutputIterator out);
+
+
+#include "edmonds_optimum_branching_impl.hpp"
+
+
+#endif // not EDMONDS_OPTIMUM_BRANCHING_HPP
diff --git a/src/edmonds_optimum_branching_impl.hpp b/src/edmonds_optimum_branching_impl.hpp
new file mode 100644
index 0000000..d1f1693
--- /dev/null
+++ b/src/edmonds_optimum_branching_impl.hpp
@@ -0,0 +1,553 @@
+//
+// See Edmonds' Algorithm on http://edmonds-alg.sourceforge.net.
+//
+
+#ifndef EDMONDS_OPTIMUM_BRANCHING_IMPL_HPP
+#define EDMONDS_OPTIMUM_BRANCHING_IMPL_HPP
+
+#include <vector>
+#include <algorithm>
+#include <list>
+#include <boost/property_map/property_map.hpp>
+#include <boost/foreach.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/graph_concepts.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/pending/disjoint_sets.hpp>
+
+
+
+// namespace detail
+//
+// The namespace encapsulates classes and/or functions that are
+// required for the implementation of edmonds's optimum branching
+// algorithm which should not be visible to the user. This way the
+// global namespace remains unpolluted.
+namespace detail {
+    using namespace boost;
+
+
+
+    // class OptimumBranching
+    //
+    // I encapsulate all the details of edmonds's algorithm inside a
+    // class. This makes the code easier to read (and easier to write)
+    // since the number of template declarations is reduced
+    // considerably. Besides, all the utility functions used to
+    // implement one algorithm conceptually do belong together.
+    //
+    // Note that any concept checks are performed in the function that
+    // uses this class, so there is no need to repeat them here.
+    template <bool TOptimumIsMaximum,
+              bool TAttemptToSpan,
+              bool TGraphIsDense,
+              class TEdgeListGraph,
+              class TVertexIndexMap,
+              class TWeightMap,
+              class TInputIterator,
+              class TOutputIterator>
+    class OptimumBranching {
+    public:
+        typedef TEdgeListGraph                                        Graph;
+        typedef typename graph_traits<Graph>::edge_descriptor         Edge;
+        typedef typename graph_traits<Graph>::vertex_descriptor       Vertex;
+        typedef typename graph_traits<Graph>::edge_iterator           EdgeIter;
+        typedef typename property_traits<TWeightMap>::value_type      weight_t;
+        typedef typename property_traits<TVertexIndexMap>::value_type vertex_idx_t;
+
+
+
+        // struct EdgeNode
+        //
+        // One unique EdgeNode object is created for each edge of the
+        // input graph. Any containers then store pointers to these
+        // objects. The edges of the graph F (which is described in
+        // the document describing the implementation) are stored in
+        // each EdgeNode object via the parent and children members.
+        // For efficiency reasons a boolean member 'removed_from_F' is
+        // also present in each EdgeNode object. If this member is
+        // set, then the edge (which is also a vertex in F) was
+        // removed during the expansion phase of the algorithm.
+        struct EdgeNode {
+            Edge                        edge;
+            vertex_idx_t                source;
+            vertex_idx_t                target;
+            weight_t                    weight;
+            EdgeNode                   *parent;
+            std::vector<EdgeNode *>     children;
+            bool                        removed_from_F;
+            
+            EdgeNode(const Edge &e,
+                     const vertex_idx_t &s,
+                     const vertex_idx_t &t,
+                     const weight_t w)
+                : edge(e), source(s), target(t), weight(w), parent(0),
+                  removed_from_F(false)
+            {
+                ;
+            }
+
+            // operator<
+            //
+            // This is only used temporarily when sorting the
+            // EdgeNodes by their sources. Once a radix-sort algorithm
+            // has been implemented, this is no longer needed.
+            bool        operator<(const EdgeNode &en) const
+            {
+                return source < en.source;
+            }
+        };
+        
+
+
+        // The data members of the OptimumBranching class. These
+        // include both the input and the variables needed internally for the implemenationa.
+        const TEdgeListGraph   &g;
+        const TVertexIndexMap  &index;
+        const TWeightMap       &weight;
+        TInputIterator          roots_begin;
+        TInputIterator          roots_end;
+        TOutputIterator         out;
+        
+        // The constructor
+        OptimumBranching(const TEdgeListGraph &g,
+                         const TVertexIndexMap &index,
+                         const TWeightMap &weight,
+                         TInputIterator roots_begin,
+                         TInputIterator roots_end,
+                         TOutputIterator out)
+            : g(g), index(index), weight(weight),
+              roots_begin(roots_begin), roots_end(roots_end), out(out)
+        {
+            ;
+        }
+
+
+
+        // remove_from_F()
+        //
+        // It removes the EdgeNode en and all its ancestors from the
+        // graph F (by resetting the parent and children members and
+        // setting the flag removed_from_F). Any newly created roots
+        // of F are inserted into F_roots. Note that the root of F
+        // that is removed as a consequence is not actually removed
+        // from F_roots. It is simply marked as removed via the
+        // 'removed_from_F' flag.
+        void remove_from_F(EdgeNode *en, std::vector<EdgeNode *> &F_roots)
+        {
+            // Note that en is inserted into F_roots as well. But
+            // since it is marked as removed_from_F it will not cause
+            // any trouble. This is more efficient than making sure
+            // that only the siblings of en are inserted into F_roots.
+            for ( ; en != 0; en = en->parent)
+            {
+                en->removed_from_F = true;
+                BOOST_FOREACH (EdgeNode *child, en->children)
+                {
+                    F_roots.push_back(child);
+                    child->parent = 0;
+                }
+
+                // free the memory used in en->children.
+                std::vector<EdgeNode *>().swap(en->children);
+            }
+        }
+
+        
+        // sort_edges()
+        //
+        // sorts a vector of EdgeNode pointers with EdgeNode.source as
+        // key using the radix-sort algorithm. Also, if there are
+        // several EdgeNode pointers with the same source, the
+        // function only keeps the one with optimum weight.
+        void sort_edges(std::vector<EdgeNode *> &edge_vec)
+        {
+            const int byte_len = 8;
+            const int num_buckets = 1u << byte_len;
+            const unsigned digits = (sizeof (vertex_idx_t)) * std::numeric_limits<unsigned char>::digits;
+            const unsigned mask = (1u << byte_len) - 1;
+
+            std::vector< std::list<EdgeNode *> > buckets(num_buckets);
+
+            for (unsigned i = 0; byte_len * i <= digits; ++i)
+            {
+                BOOST_FOREACH (EdgeNode *en, edge_vec)
+                {
+                    buckets[(en->source >> byte_len * i) & mask].push_back(en);
+                }
+
+                edge_vec.clear();
+                BOOST_FOREACH (std::list<EdgeNode *> &bucket, buckets)
+                {
+                    BOOST_FOREACH (EdgeNode *en, bucket)
+                    {
+                        if (!edge_vec.empty() && edge_vec.back()->source == en->source)
+                        {
+                            bool en_is_better = TOptimumIsMaximum ?
+                                en->weight > edge_vec.back()->weight :
+                                en->weight < edge_vec.back()->weight;
+                            if (en_is_better)
+                            {
+                                edge_vec.back() = en;
+                            }
+                        }
+                        else
+                        {
+                            edge_vec.push_back(en);
+                        }
+                    }
+                }
+
+                buckets.clear();
+                buckets.resize(num_buckets);
+            }
+        }
+
+
+        // operator()
+        //
+        // This is the main function implementing Tarjan's
+        // implementation of Edmonds's algorithm.
+        void operator()()
+        {
+            std::vector<EdgeNode> all_edges;
+            vertex_idx_t max_vertex_idx;
+
+            // Create EdgeNodes for all the edges and find the maximum vertex
+            // index. Note that we skip self-loops.
+            max_vertex_idx = 0;
+            BOOST_FOREACH (const Edge &e, edges(g))
+            {
+                if (source(e, g) == target(e, g))
+                    continue;
+
+                all_edges.push_back(EdgeNode (e, source(e, g), target(e, g), get(weight, e)));
+                max_vertex_idx = std::max(max_vertex_idx, index[target(e, g)]);
+            }
+
+            // insert into in_edges[v] all edges entering v.
+
+            //!! TODO !! If sparse graphs, I have to change the
+            //representation of in_edges to a special kind of priority
+            //queue that are able to be merged in log n time.
+
+            std::vector< std::vector<EdgeNode *> > in_edges(max_vertex_idx + 1);
+            std::vector<weight_t> edge_weight_change(max_vertex_idx + 1);
+            BOOST_FOREACH (EdgeNode &en, all_edges)
+            {
+                in_edges[en.target].push_back(&en);
+            }
+            BOOST_FOREACH (std::vector<EdgeNode *> &edges, in_edges)
+            {
+                sort_edges(edges);
+            }
+
+            // Save the specified roots in a random access fashion.
+            std::vector<bool> is_specified_root(max_vertex_idx);
+            std::vector<vertex_idx_t> final_roots;
+            for ( ; roots_begin != roots_end; ++roots_begin)
+            {
+                is_specified_root[index[*roots_begin]] = true;
+                final_roots.push_back(index[*roots_begin]);
+            }
+
+            // Initialize S, W, roots, cycles, lambda, enter, F, and min
+            std::vector< std::vector<EdgeNode *> > cycle(max_vertex_idx + 1);
+            std::vector<EdgeNode *> lambda(max_vertex_idx + 1);
+            std::vector<vertex_idx_t> roots;
+            disjoint_sets_with_storage<> S(2*(max_vertex_idx +1));
+            disjoint_sets_with_storage<> W(2*(max_vertex_idx +1));
+            std::vector<vertex_idx_t> min(max_vertex_idx + 1);
+            std::vector<EdgeNode *> enter(max_vertex_idx + 1);
+            std::vector<EdgeNode *> F;
+            for (vertex_idx_t v = 0; v <= max_vertex_idx; ++v)
+            {
+                S.make_set(v);
+                W.make_set(v);
+                min[v] = v;
+                if (!is_specified_root[v])
+                    roots.push_back(v);
+            }
+
+            // Keep adding critical edges and contracting cycles while
+            // doing a whole bunch of book-keeping.
+            while (!roots.empty())
+            {
+                // Find an S-component with an entering edge
+                vertex_idx_t cur_root = roots.back(); roots.pop_back();
+                if (in_edges[cur_root].empty())
+                {
+                    final_roots.push_back(min[cur_root]);
+                    continue;
+                }
+
+                // Find an optimum-weight edge entering cur_root
+
+                //!! TODO !! We have to do this differently for sparse graphs.
+                EdgeNode *critical_edge = in_edges[cur_root].front();
+                BOOST_FOREACH (EdgeNode *en, in_edges[cur_root])
+                {
+                    bool en_is_better = TOptimumIsMaximum ?
+                        en->weight > critical_edge->weight :
+                        en->weight < critical_edge->weight;
+                    if (en_is_better)
+                    {
+                        critical_edge = en;
+                    }
+                }
+                
+                // Do not add critical_edge if it worsens the total
+                // weight and we are not attempting to span.
+                if (!TAttemptToSpan)
+                {
+                    bool improves = TOptimumIsMaximum ?
+                        critical_edge->weight > weight_t(0) :
+                        critical_edge->weight < weight_t(0);
+                    if (!improves)
+                    {
+                        continue;
+                    }
+                }
+                
+                // Insert critical_edge into "F" and let any edges in
+                // cycle[cur_root] be its children.
+                F.push_back(critical_edge);
+                BOOST_FOREACH (EdgeNode *en, cycle[cur_root])
+                {
+                    en->parent = critical_edge;
+                    critical_edge->children.push_back(en);
+                }
+
+                // If critical_edge is a leaf in "F", then add a
+                // pointer to it.
+                if (cycle[cur_root].empty())
+                {
+                    lambda[cur_root] = critical_edge;
+                }
+
+                // If adding critical_edge didn't create a cycle
+                if (W.find_set(critical_edge->source) !=
+                    W.find_set(critical_edge->target))
+                {
+                    enter[cur_root] = critical_edge;
+                    W.union_set(critical_edge->source, critical_edge->target);
+                }
+                else // If adding critical_edge did create a cycle
+                {
+                    // Find the edges of the cycle, the
+                    // representatives of the strong components in the
+                    // cycle, and the least costly edge of the cycle.
+                    std::vector<EdgeNode *> cycle_edges;
+                    std::vector<vertex_idx_t> cycle_repr;
+                    EdgeNode *least_costly_edge = critical_edge;
+                    enter[cur_root] = 0;
+
+                    cycle_edges.push_back(critical_edge);
+                    cycle_repr.push_back(S.find_set(critical_edge->target));
+                    for (vertex_idx_t v = S.find_set(critical_edge->source);
+                         enter[v] != 0; v = S.find_set(enter[v]->source))
+                    {
+                        cycle_edges.push_back(enter[v]);
+                        cycle_repr.push_back(v);
+                        bool is_less_costly = TOptimumIsMaximum ?
+                            enter[v]->weight < least_costly_edge->weight :
+                            enter[v]->weight > least_costly_edge->weight;
+                        if (is_less_costly)
+                        {
+                            least_costly_edge = enter[v];
+                        }
+                    }
+                    // change the weight of the edges entering
+                    // vertices of the cycle.
+                    //!! TODO !! Change this for sparse graphs
+                    BOOST_FOREACH (EdgeNode *en, cycle_edges)
+                    {
+                        edge_weight_change[S.find_set(en->target)] =
+                            least_costly_edge->weight - en->weight;
+                    }
+
+                    // Save the vertex that would be root if the newly
+                    // created strong component would be a root.
+                    vertex_idx_t cycle_root =
+                        min[S.find_set(least_costly_edge->target)];
+
+                    // Union all components of the cycle into one component.
+                    vertex_idx_t new_repr = cycle_repr.front();
+                    BOOST_FOREACH (vertex_idx_t v, cycle_repr)
+                    {
+                        S.link(v, new_repr);
+                        new_repr = S.find_set(new_repr);
+                    }
+                    min[new_repr] = cycle_root;
+                    roots.push_back(new_repr);
+                    cycle[new_repr].swap(cycle_edges);
+
+                    //!! TODO !! Needs to be changed for sparse graphs.
+                    BOOST_FOREACH (vertex_idx_t v, cycle_repr)
+                    {
+                        BOOST_FOREACH (EdgeNode *en, in_edges[v])
+                        {
+                            en->weight += edge_weight_change[v];
+                        }
+                    }
+
+                    // Merge all in_edges of the cycle into one list.
+                    //!! TODO !! needs to be changed for sparse graphs.
+                    std::vector<EdgeNode *> new_in_edges;
+                    for (unsigned i = 1; i < cycle_repr.size(); ++i)
+                    {
+                        typedef typename std::vector<EdgeNode *>::iterator Iter;
+                        Iter i1 = in_edges[cycle_repr[i]].begin();
+                        Iter e1 = in_edges[cycle_repr[i]].end();
+                        Iter i2 = in_edges[cycle_repr[i-1]].begin();
+                        Iter e2 = in_edges[cycle_repr[i-1]].end();
+                     
+                        ///*
+                        while (i1 != e1 || i2 != e2)
+                        {
+                            while (i1 != e1 && S.find_set((*i1)->source) == new_repr)
+                            {
+                                ++i1;
+                            }
+                            while (i2 != e2 && S.find_set((*i2)->source) == new_repr)
+                            {
+                                ++i2;
+                            }
+
+                            if (i1 == e1 && i2 == e2)
+                                break;
+
+                            if (i1 == e1)
+                            {
+                                new_in_edges.push_back(*i2);
+                                ++i2;
+                            }
+                            else if (i2 == e2)
+                            {
+                                new_in_edges.push_back(*i1);
+                                ++i1;
+                            }
+                            else if (((*i1)->source) < ((*i2)->source))
+                            {
+                                new_in_edges.push_back(*i1);
+                                ++i1;
+                            }
+                            else if ((*i1)->source > (*i2)->source)
+                            {
+                                new_in_edges.push_back(*i2);
+                                ++i2;
+                            }
+                            else // if the sources are equal
+                            {
+                                bool i1_is_better = TOptimumIsMaximum ?
+                                    (*i1)->weight > (*i2)->weight :
+                                    (*i1)->weight < (*i2)->weight;
+                                if (i1_is_better)
+                                {
+                                    new_in_edges.push_back(*i1);
+                                }
+                                else
+                                {
+                                    new_in_edges.push_back(*i2);
+                                }
+                                ++i1;
+                                ++i2;
+                            }
+                        }
+                        in_edges[cycle_repr[i]].swap(new_in_edges);
+                        new_in_edges.clear();
+                    }
+                    in_edges[new_repr].swap(in_edges[cycle_repr.back()]);
+                    edge_weight_change[new_repr] = weight_t(0);
+                    //*/
+                }
+            } // while (!roots.empty())
+            
+            // Extract the optimum branching
+
+            // Find all roots of F.
+            std::vector<EdgeNode *> F_roots;
+            BOOST_FOREACH (EdgeNode *en, F)
+            {
+                if (en->parent == 0)
+                {
+                    F_roots.push_back(en);
+                }
+            }
+
+            // Remove edges entering the root nodes.
+            BOOST_FOREACH (vertex_idx_t v, final_roots)
+            {
+                if (lambda[v] != 0)
+                {
+                    remove_from_F(lambda[v], F_roots);
+                }
+            }
+            
+            while (!F_roots.empty())
+            {
+                EdgeNode *en = F_roots.back(); F_roots.pop_back();
+                if (en->removed_from_F)
+                    continue;
+
+                *out = en->edge;
+                ++out;
+                remove_from_F(lambda[en->target], F_roots);
+            }
+        }
+
+    };
+}
+
+template <bool TOptimumIsMaximum,
+          bool TAttemptToSpan,
+          bool TGraphIsDense,
+          class TEdgeListGraph,
+          class TVertexIndexMap,
+          class TWeightMap,
+          class TInputIterator,
+          class TOutputIterator>
+void
+edmonds_optimum_branching(TEdgeListGraph &g,
+                          TVertexIndexMap index,
+                          TWeightMap weight,
+                          TInputIterator roots_begin,
+                          TInputIterator roots_end,
+                          TOutputIterator out)
+{
+    using namespace boost;
+
+    typedef typename graph_traits<TEdgeListGraph>::edge_descriptor    Edge;
+    typedef typename graph_traits<TEdgeListGraph>::vertex_descriptor  Vertex;
+    typedef typename graph_traits<TEdgeListGraph>::edge_iterator      EdgeIter;
+    typedef typename property_traits<TWeightMap>::value_type          weight_t;
+
+    function_requires< EdgeListGraphConcept<TEdgeListGraph> >();
+    function_requires< ReadablePropertyMapConcept<TWeightMap, Edge> >();
+    function_requires< ReadablePropertyMapConcept<TVertexIndexMap, Vertex> >();
+    function_requires< InputIteratorConcept<TInputIterator> >();
+    function_requires< OutputIteratorConcept<TOutputIterator, Edge> >();
+    //!! Add the following requirements:
+    // 
+    // property_traits<TVertexIndexMap>::value_type is a built-in
+    // integral type, or perhaps require that it can be used to index
+    // into arrays.
+    // 
+    // property_traits<TWeightMap>::value_type is a numeric type that
+    // handles the operations +, -, and <.
+    // 
+    // TInputIterator's value type is Vertex
+    // TOutputIterator's value type is Edge
+    
+
+    ::detail::OptimumBranching<TOptimumIsMaximum, TAttemptToSpan,
+        TGraphIsDense, TEdgeListGraph, TVertexIndexMap, TWeightMap,
+        TInputIterator, TOutputIterator>
+          optimum_branching(g, index, weight, roots_begin, roots_end, out);
+    optimum_branching();
+}
+    
+
+
+
+#endif // not EDMONDS_OPTIMUM_BRANCHING_IMPL_HPP
diff --git a/src/fruchterman_reingold.hpp b/src/fruchterman_reingold.hpp
new file mode 100644
index 0000000..ada3815
--- /dev/null
+++ b/src/fruchterman_reingold.hpp
@@ -0,0 +1,477 @@
+// Copyright 2004 The Trustees of Indiana University.
+
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+//  Authors: Douglas Gregor
+//           Andrew Lumsdaine
+#ifndef BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP
+#define BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP
+
+#include <cmath>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/simple_point.hpp>
+#include <vector>
+#include <list>
+#include <algorithm> // for std::min and std::max
+
+namespace boost {
+
+struct square_distance_attractive_force {
+  template<typename Graph, typename T>
+  T
+  operator()(typename graph_traits<Graph>::edge_descriptor,
+             T k,
+             T d,
+             const Graph&) const
+  {
+    return d * d / k;
+  }
+};
+
+struct square_distance_repulsive_force {
+  template<typename Graph, typename T>
+  T
+  operator()(typename graph_traits<Graph>::vertex_descriptor,
+             typename graph_traits<Graph>::vertex_descriptor,
+             T k,
+             T d,
+             const Graph&) const
+  {
+    return (d > 0 ? (k * k / d) : 0);
+  }
+};
+
+template<typename T>
+struct linear_cooling {
+  typedef T result_type;
+
+  linear_cooling(std::size_t iterations)
+    : temp(T(iterations) / T(10)), step(0.1) { }
+
+  linear_cooling(std::size_t iterations, T temp)
+    : temp(temp), step(temp / T(iterations)) { }
+
+  T operator()()
+  {
+    T old_temp = temp;
+    temp -= step;
+    if (temp < T(0)) temp = T(0);
+    return old_temp;
+  }
+
+ private:
+  T temp;
+  T step;
+};
+
+/*
+struct all_force_pairs
+{
+  template<typename Graph, typename ApplyForce >
+  void operator()(const Graph& g, ApplyForce apply_force)
+  {
+    typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator;
+    vertex_iterator v, end;
+    for (tie(v, end) = vertices(g); v != end; ++v) {
+      vertex_iterator u = v;
+      for (++u; u != end; ++u) {
+        apply_force(*u, *v);
+        apply_force(*v, *u);
+      }
+    }
+  }
+};
+*/
+
+template<typename Dim, typename PositionMap>
+struct grid_force_pairs
+{
+  template<typename Graph>
+  explicit
+  grid_force_pairs(Dim width, Dim height, PositionMap position, const Graph& g)
+    : width(width), height(height), position(position)
+  {
+#ifndef BOOST_NO_STDC_NAMESPACE
+    using std::sqrt;
+#endif // BOOST_NO_STDC_NAMESPACE
+    two_k = Dim(2) * sqrt(width*height / num_vertices(g));
+  }
+
+  template<typename Graph, typename ApplyForce >
+  void operator()(const Graph& g, ApplyForce apply_force)
+  {
+    typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator;
+    typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+    typedef std::list<vertex_descriptor> bucket_t;
+    typedef std::vector<bucket_t> buckets_t;
+
+    std::size_t columns = std::size_t(width / two_k + Dim(1));
+    std::size_t rows = std::size_t(height / two_k + Dim(1));
+    buckets_t buckets(rows * columns);
+    vertex_iterator v, v_end;
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      std::size_t column = std::size_t((position[*v].x + width  / 2) / two_k);
+      std::size_t row    = std::size_t((position[*v].y + height / 2) / two_k);
+
+      if (column >= columns) column = columns - 1;
+      if (row >= rows) row = rows - 1;
+      buckets[row * columns + column].push_back(*v);
+    }
+
+    for (std::size_t row = 0; row < rows; ++row)
+      for (std::size_t column = 0; column < columns; ++column) {
+        bucket_t& bucket = buckets[row * columns + column];
+        typedef typename bucket_t::iterator bucket_iterator;
+        for (bucket_iterator u = bucket.begin(); u != bucket.end(); ++u) {
+          // Repulse vertices in this bucket
+          bucket_iterator v = u;
+          for (++v; v != bucket.end(); ++v) {
+            apply_force(*u, *v);
+            apply_force(*v, *u);
+          }
+
+          std::size_t adj_start_row = row == 0? 0 : row - 1;
+          std::size_t adj_end_row = row == rows - 1? row : row + 1;
+          std::size_t adj_start_column = column == 0? 0 : column - 1;
+          std::size_t adj_end_column = column == columns - 1? column : column + 1;
+          for (std::size_t other_row = adj_start_row; other_row <= adj_end_row;
+               ++other_row)
+            for (std::size_t other_column = adj_start_column; 
+                 other_column <= adj_end_column; ++other_column)
+              if (other_row != row || other_column != column) {
+                // Repulse vertices in this bucket
+                bucket_t& other_bucket 
+                  = buckets[other_row * columns + other_column];
+                for (v = other_bucket.begin(); v != other_bucket.end(); ++v)
+                  apply_force(*u, *v);
+              }
+        }
+      }
+  }
+
+ private:
+  Dim width;
+  Dim height;
+  PositionMap position;
+  Dim two_k;
+};
+
+template<typename Dim, typename PositionMap, typename Graph>
+inline grid_force_pairs<Dim, PositionMap>
+make_grid_force_pairs(Dim width, Dim height, const PositionMap& position,
+                      const Graph& g)
+{ return grid_force_pairs<Dim, PositionMap>(width, height, position, g); }
+
+/*
+template<typename Graph, typename PositionMap, typename Dim>
+void
+scale_graph(const Graph& g, PositionMap position,
+            Dim left, Dim top, Dim right, Dim bottom)
+{
+  if (num_vertices(g) == 0) return;
+
+  if (bottom > top) {
+    using std::swap;
+    swap(bottom, top);
+  }
+
+  typedef typename graph_traits<Graph>::vertex_iterator vertex_iterator;
+
+  // Find min/max ranges
+  Dim minX = position[*vertices(g).first].x, maxX = minX;
+  Dim minY = position[*vertices(g).first].y, maxY = minY;
+  vertex_iterator vi, vi_end;
+  for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) {
+    BOOST_USING_STD_MIN();
+    BOOST_USING_STD_MAX();
+    minX = min BOOST_PREVENT_MACRO_SUBSTITUTION (minX, position[*vi].x);
+    maxX = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxX, position[*vi].x);
+    minY = min BOOST_PREVENT_MACRO_SUBSTITUTION (minY, position[*vi].y);
+    maxY = max BOOST_PREVENT_MACRO_SUBSTITUTION (maxY, position[*vi].y);
+  }
+
+  // Scale to bounding box provided
+  for (tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi) {
+    position[*vi].x = ((position[*vi].x - minX) / (maxX - minX))
+                    * (right - left) + left;
+    position[*vi].y = ((position[*vi].y - minY) / (maxY - minY))
+                    * (top - bottom) + bottom;
+  }
+}
+*/
+
+namespace detail {
+  template<typename PositionMap, typename DisplacementMap,
+           typename RepulsiveForce, typename Dim, typename Graph>
+  struct fr_apply_force
+  {
+    typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+
+    fr_apply_force(const PositionMap& position,
+                   const DisplacementMap& displacement,
+                   RepulsiveForce repulsive_force, Dim k, const Graph& g)
+      : position(position), displacement(displacement),
+        repulsive_force(repulsive_force), k(k), g(g)
+    { }
+
+    void operator()(vertex_descriptor u, vertex_descriptor v)
+    {
+#ifndef BOOST_NO_STDC_NAMESPACE
+      using std::sqrt;
+#endif // BOOST_NO_STDC_NAMESPACE
+      if (u != v) {
+        Dim delta_x = position[v].x - position[u].x;
+        Dim delta_y = position[v].y - position[u].y;
+        Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y);
+        Dim fr = repulsive_force(u, v, k, dist, g);
+        if ( dist > 0 ) 
+        {
+        displacement[v].x += delta_x / dist * fr;
+        displacement[v].y += delta_y / dist * fr;
+        }
+      }
+    }
+
+  private:
+    PositionMap position;
+    DisplacementMap displacement;
+    RepulsiveForce repulsive_force;
+    Dim k;
+    const Graph& g;
+  };
+
+} // end namespace detail
+
+template<typename Graph, typename PositionMap, typename Dim,
+         typename AttractiveForce, typename RepulsiveForce,
+         typename ForcePairs, typename Cooling, typename DisplacementMap>
+void
+fruchterman_reingold_force_directed_layout
+ (const Graph&    g,
+  PositionMap     position,
+  Dim             width,
+  Dim             height,
+  AttractiveForce attractive_force,
+  RepulsiveForce  repulsive_force,
+  ForcePairs      force_pairs,
+  Cooling         cool,
+  DisplacementMap displacement)
+{
+  typedef typename graph_traits<Graph>::vertex_iterator   vertex_iterator;
+  typedef typename graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+  typedef typename graph_traits<Graph>::edge_iterator     edge_iterator;
+
+#ifndef BOOST_NO_STDC_NAMESPACE
+  using std::sqrt;
+#endif // BOOST_NO_STDC_NAMESPACE
+
+  Dim area = width * height;
+  // assume positions are initialized randomly
+  Dim k = sqrt(area / num_vertices(g));
+
+  detail::fr_apply_force<PositionMap, DisplacementMap,
+                         RepulsiveForce, Dim, Graph>
+    apply_force(position, displacement, repulsive_force, k, g);
+
+  Dim temp = cool();
+  if (temp) do {
+    // Calculate repulsive forces
+    vertex_iterator v, v_end;
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      displacement[*v].x = 0;
+      displacement[*v].y = 0;
+    }
+    force_pairs(g, apply_force);
+
+#if DEBUG
+    std::cout << " temp = " << temp << std::endl;
+    std::cout << " after force_pairs " << std::endl;
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      std::cout << " node " << *v 
+                << " displacement: x = " << displacement[*v].x 
+                << " y = " << displacement[*v].y 
+                << std::endl;
+      std::cout << "       " 
+                << " position:     x = " << position[*v].x 
+                << " y = " << position[*v].y 
+                << std::endl;
+    }
+#endif
+
+    // Calculate attractive forces
+    edge_iterator e, e_end;
+    for (tie(e, e_end) = edges(g); e != e_end; ++e) {
+      vertex_descriptor v = source(*e, g);
+      vertex_descriptor u = target(*e, g);
+      Dim delta_x = position[v].x - position[u].x;
+      Dim delta_y = position[v].y - position[u].y;
+      Dim dist = sqrt(delta_x * delta_x + delta_y * delta_y);
+      Dim fa = attractive_force(*e, k, dist, g);
+
+      if ( dist > 0 ) 
+      {
+      displacement[v].x -= delta_x / dist * fa;
+      displacement[v].y -= delta_y / dist * fa;
+      displacement[u].x += delta_x / dist * fa;
+      displacement[u].y += delta_y / dist * fa;
+      }
+    }
+
+#if DEBUG
+    std::cout << " after attractive_force " << std::endl;
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      std::cout << " node " << *v 
+                << " displacement: x = " << displacement[*v].x 
+                << " y = " << displacement[*v].y 
+                << std::endl;
+      std::cout << "       " 
+                << " position:     x = " << position[*v].x 
+                << " y = " << position[*v].y 
+                << std::endl;
+    }
+#endif
+
+    // Update positions
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      BOOST_USING_STD_MIN();
+      BOOST_USING_STD_MAX();
+      Dim disp_size = sqrt(displacement[*v].x * displacement[*v].x
+                           + displacement[*v].y * displacement[*v].y);
+      if ( disp_size > 0 )
+      {
+      position[*v].x += displacement[*v].x / disp_size 
+                     * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp);
+      position[*v].y += displacement[*v].y / disp_size 
+                     * min BOOST_PREVENT_MACRO_SUBSTITUTION (disp_size, temp);
+      }
+      position[*v].x = min BOOST_PREVENT_MACRO_SUBSTITUTION 
+                         (width / 2, 
+                          max BOOST_PREVENT_MACRO_SUBSTITUTION(-width / 2, 
+                                                               position[*v].x));
+      position[*v].y = min BOOST_PREVENT_MACRO_SUBSTITUTION
+                         (height / 2, 
+                          max BOOST_PREVENT_MACRO_SUBSTITUTION(-height / 2, 
+                                                               position[*v].y));
+    }
+
+#if DEBUG
+    std::cout << " after update positions " << std::endl;
+    for (tie(v, v_end) = vertices(g); v != v_end; ++v) {
+      std::cout << " node " << *v 
+                << " displacement: x = " << displacement[*v].x 
+                << " y = " << displacement[*v].y 
+                << std::endl;
+      std::cout << "       " 
+                << " position:     x = " << position[*v].x 
+                << " y = " << position[*v].y 
+                << std::endl;
+    }
+#endif
+
+  } while (temp = cool());
+}
+
+namespace detail {
+  template<typename DisplacementMap>
+  struct fr_force_directed_layout
+  {
+    template<typename Graph, typename PositionMap, typename Dim,
+             typename AttractiveForce, typename RepulsiveForce,
+             typename ForcePairs, typename Cooling,
+             typename Param, typename Tag, typename Rest>
+    static void
+    run(const Graph&    g,
+        PositionMap     position,
+        Dim             width,
+        Dim             height,
+        AttractiveForce attractive_force,
+        RepulsiveForce  repulsive_force,
+        ForcePairs      force_pairs,
+        Cooling         cool,
+        DisplacementMap displacement,
+        const bgl_named_params<Param, Tag, Rest>&)
+    {
+      fruchterman_reingold_force_directed_layout
+        (g, position, width, height, attractive_force, repulsive_force,
+         force_pairs, cool, displacement);
+    }
+  };
+
+  template<>
+  struct fr_force_directed_layout<error_property_not_found>
+  {
+    template<typename Graph, typename PositionMap, typename Dim,
+             typename AttractiveForce, typename RepulsiveForce,
+             typename ForcePairs, typename Cooling,
+             typename Param, typename Tag, typename Rest>
+    static void
+    run(const Graph&    g,
+        PositionMap     position,
+        Dim             width,
+        Dim             height,
+        AttractiveForce attractive_force,
+        RepulsiveForce  repulsive_force,
+        ForcePairs      force_pairs,
+        Cooling         cool,
+        error_property_not_found,
+        const bgl_named_params<Param, Tag, Rest>& params)
+    {
+      std::vector<simple_point<Dim> > displacements(num_vertices(g));
+      fruchterman_reingold_force_directed_layout
+        (g, position, width, height, attractive_force, repulsive_force,
+         force_pairs, cool,
+         make_iterator_property_map
+         (displacements.begin(),
+          choose_const_pmap(get_param(params, vertex_index), g,
+                            vertex_index),
+          simple_point<Dim>()));
+    }
+  };
+
+} // end namespace detail
+
+template<typename Graph, typename PositionMap, typename Dim, typename Param,
+         typename Tag, typename Rest>
+void
+fruchterman_reingold_force_directed_layout
+  (const Graph&    g,
+   PositionMap     position,
+   Dim             width,
+   Dim             height,
+   const bgl_named_params<Param, Tag, Rest>& params)
+{
+  typedef typename property_value<bgl_named_params<Param,Tag,Rest>,
+                                  vertex_displacement_t>::type D;
+
+  detail::fr_force_directed_layout<D>::run
+    (g, position, width, height,
+     choose_param(get_param(params, attractive_force_t()),
+                  square_distance_attractive_force()),
+     choose_param(get_param(params, repulsive_force_t()),
+                  square_distance_repulsive_force()),
+     choose_param(get_param(params, force_pairs_t()),
+                  make_grid_force_pairs(width, height, position, g)),
+     choose_param(get_param(params, cooling_t()),
+                  linear_cooling<Dim>(100)),
+     get_param(params, vertex_displacement_t()),
+     params);
+}
+
+template<typename Graph, typename PositionMap, typename Dim>
+void
+fruchterman_reingold_force_directed_layout(const Graph&    g,
+                                           PositionMap     position,
+                                           Dim             width,
+                                           Dim             height)
+{
+  fruchterman_reingold_force_directed_layout
+    (g, position, width, height,
+     attractive_force(square_distance_attractive_force()));
+}
+
+} // end namespace boost
+
+#endif // BOOST_GRAPH_FRUCHTERMAN_REINGOLD_FORCE_DIRECTED_LAYOUT_HPP
diff --git a/src/hcs.cpp b/src/hcs.cpp
new file mode 100644
index 0000000..aff0dd0
--- /dev/null
+++ b/src/hcs.cpp
@@ -0,0 +1,484 @@
+#include "RBGL.hpp"
+#include "mincut.hpp"
+
+// low-degree-vertice removal: external input of a decreasing sequence of int
+std::vector<int> LDV;
+
+int singleton_adoption_threshold=0; 
+
+using namespace boost;
+using namespace std;
+
+typedef graph_traits < Graph_ud >::vertex_descriptor vertex_descriptor;
+typedef graph_traits < Graph_ud >::vertex_iterator   vertex_iterator;
+typedef graph_traits < Graph_ud >::edge_descriptor   edge_descriptor;
+typedef graph_traits < Graph_ud >::edge_iterator     edge_iterator;
+typedef graph_traits < Graph_ud >::edges_size_type   dst;
+
+typedef std::vector<vertex_descriptor> Cluster;
+typedef std::set<vertex_descriptor>    ClusterAsSet;
+typedef std::vector<int>               V_Label;
+typedef std::set<int>                  V_LabelAsSet;
+typedef std::vector<V_Label>           ClusterResult;
+
+#if DEBUG
+static void output_graph_labels(const V_Label& v_label, const char* prompt)
+{
+    cout << prompt;
+    for ( unsigned int j = 0; j < v_label.size(); j++ )
+        cout << v_label[j] << " ";
+    cout << endl << flush;
+}
+
+static void output_graph(const Graph_ud& g, const char* prompt)
+{
+    cout << prompt << " vertices in " << ": ";
+    vertex_iterator vi, ve;
+    for ( tie(vi, ve) = vertices(g); vi != ve; vi++ )
+        cout << *vi+1 << " ";
+    cout << endl;
+
+    cout << prompt << " edges in " << ": ";
+    edge_iterator ei, ee;
+    vertex_descriptor u, v;
+    for ( tie(ei, ee) = edges(g); ei != ee; ei++ )
+    {
+        u = source(*ei, g), v = target(*ei, g);
+        cout << "(" << u+1 << "," << v+1 << ")" << " ";
+    }
+    cout << endl << flush;
+}
+#endif
+
+static void build_subgraph(Cluster& vs_vec,
+                           const Graph_ud& g_in, const V_Label& v_label_in,
+                           Graph_ud& g_out, V_Label& v_label_out)
+{
+    // turning "vector" to "set" is just to ease lookup later
+    Cluster::iterator vi;
+    ClusterAsSet vs_set;
+    for ( vi = vs_vec.begin(); vi != vs_vec.end(); vi++ )
+        vs_set.insert(*vi);
+
+    // keep track of vertex labels
+    for ( unsigned int ii = 0; ii < v_label_in.size(); ii++ )
+        if ( vs_set.count(ii) == 1 )
+            v_label_out.push_back(v_label_in[ii]);
+
+    // add edges of the subgraph
+    vertex_descriptor u, v;
+    edge_descriptor e1;
+    bool inserted;
+    edge_iterator ei, ei_end;
+    for (tie(ei, ei_end) = edges(g_in); ei != ei_end; ++ei)
+    {
+        u = source(*ei, g_in), v = target(*ei, g_in);
+        if ( vs_set.count(u) == 1 && vs_set.count(v) == 1 )
+            tie(e1, inserted) = add_edge(u, v, g_out);
+    }
+
+    // remove vertices NOT in vs_set
+    // complication comes from renumbering of vertices after removal
+    vertex_iterator vvi, vvi_end;
+    bool try_again = TRUE;
+
+    V_Label flags(num_vertices(g_out), 0);
+    V_Label::iterator fi;
+    for ( tie(vvi, vvi_end) = vertices(g_out); vvi != vvi_end; vvi++ )
+    {
+        if ( vs_set.count(*vvi) == 1 ) flags[*vvi] = 1;
+    }
+
+    while ( try_again )
+    {
+        try_again = FALSE;
+        fi = flags.begin();
+        for ( tie(vvi, vvi_end) = vertices(g_out); vvi != vvi_end; vvi++, fi++ )
+        {
+            if ( *fi == 0 )
+            {
+                boost::remove_vertex(*vvi, g_out);
+		flags.erase(fi);
+                try_again = TRUE;
+                break;
+            }
+        }
+    }
+
+#if DEBUG
+    output_graph(g_out, "build_subgraph: ");
+    output_graph_labels(v_label_out, "build_subgraph: ");
+#endif
+}
+
+// repeatedly remove all vertices of degree < LDV[i] from G
+// NOTE: "vertices w/ degree < LDV[i]" is implemented as dynamic
+static void remove_vertices(const int d,
+                            const Graph_ud& g_in, const V_Label& v_label_in,
+                            Graph_ud& g_out, V_Label& v_label_out)
+{
+    g_out = g_in;
+    v_label_out = v_label_in;
+
+    vertex_iterator vvi, vvi_end;
+    bool try_again = TRUE;
+    V_Label::iterator i;
+
+    while ( try_again )
+    {
+        try_again = FALSE;
+        i = v_label_out.begin();
+        for ( tie(vvi, vvi_end) = vertices(g_out); vvi != vvi_end; vvi++, i++ )
+        {
+            if ( out_degree(*vvi, g_out) < (unsigned int) d )
+            {
+                boost::clear_vertex(*vvi, g_out);
+                boost::remove_vertex(*vvi, g_out);
+                v_label_out.erase(i);
+                try_again = TRUE;
+                break;
+            }
+        }
+    }
+}
+
+static dst cluster_distance(const Graph_ud& g, V_Label& v_label, int si, V_Label& ci)
+{
+    dst d = 0;
+    unsigned int s_index;
+
+    for ( s_index = 0; s_index < v_label.size(); s_index++ )
+        if ( v_label[s_index] == si )
+            break;
+
+    if ( s_index >= v_label.size() ) return 0;  // ERROR
+
+    V_LabelAsSet ci_set(ci.begin(), ci.end());
+    Graph_ud::adjacency_iterator ai, ai_end;
+    for ( tie(ai, ai_end) = adjacent_vertices(s_index, g);
+            ai != ai_end; ai++ )
+        if ( ci_set.count(v_label[*ai]) == 1 ) d++;
+
+#if DEBUG
+    cout << " cluster_distance between "
+         << si << " and " << ci[0] << " is " << d
+         << endl << flush;
+#endif
+
+    return d;
+}
+
+static void adopt_singleton(const Graph_ud& g, V_Label& v_label, ClusterResult& clusters)
+{
+    V_LabelAsSet singletons;
+    V_LabelAsSet::iterator si, simax;
+
+    ClusterResult::iterator ci, cimax;
+
+    for ( ci = clusters.begin(); ci != clusters.end(); ci++ )
+        if ( (*ci).size() == 1 )
+            singletons.insert((*ci)[0]);
+
+#if DEBUG
+    cout << " found singletons: ";
+    for ( si = singletons.begin(); si != singletons.end(); si++ )
+        cout << (*si) << " ";
+    cout << endl << flush;
+#endif
+
+    dst d, dmax;
+    bool try_again = TRUE;
+
+    while ( try_again )
+    {
+        try_again = FALSE;
+
+        for ( si = singletons.begin(); si != singletons.end() && !try_again; )
+        {
+            dmax = 0;
+            cimax = clusters.begin();
+            for ( ci = clusters.begin(); ci < clusters.end(); ci++ )
+            {
+                d = cluster_distance(g, v_label, *si, *ci);
+                if ( d >= dmax && (*ci).size() > 1 )
+                {
+                    cimax = ci;
+                    dmax = d;
+                }
+            }
+
+#if DEBUG
+            cout << " max distance from " << *si
+            << " to cluster " << (*cimax)[0] << " = " << dmax
+            << endl << flush;
+            if ( dmax > singleton_adoption_threshold && (*cimax).size() > 1 )
+            {
+                cout << " inserting " << *si
+                << " to cluster " << (*cimax)[0]
+                << endl << flush;
+            }
+#endif
+
+            if ( (int) dmax > singleton_adoption_threshold && (*cimax).size() > (unsigned int) 1 )
+            {
+                // copy si to cur then increment si
+                V_LabelAsSet::iterator cur = si++;
+                (*cimax).push_back(*cur);
+                singletons.erase(cur);
+                try_again = TRUE;
+            }
+            else
+            {
+                ++si;
+            }
+        }
+    }
+
+    // remove singletons from clusters
+    try_again = TRUE;
+    while ( try_again )
+    {
+        try_again = FALSE;
+        for ( ci = clusters.begin(); ci != clusters.end() && !try_again; ci++ )
+        {
+            if ( (*ci).size() == 1 && singletons.count((*ci)[0]) == 0 )
+            {
+                clusters.erase(ci);
+                try_again = TRUE;
+            }
+        }
+    }
+}
+
+static void remove_clusters(ClusterResult& clusters,
+                            const Graph_ud& g_in,  const V_Label& v_label_in,
+                            Graph_ud& g_out, V_Label& v_label_out)
+{
+    ClusterResult::iterator ci;
+    V_Label::iterator       vi;
+    V_LabelAsSet            v_set;
+
+    for ( ci = clusters.begin(); ci < clusters.end(); ci++ )
+    {
+        for ( vi = (*ci).begin(); vi != (*ci).end(); vi++ )
+            v_set.insert(*vi);
+    }
+
+    Cluster v_vec;
+
+    // TODO: go over vertices instead of label indices??
+    for ( unsigned int i = 0; i < v_label_in.size(); i++ )
+        if ( v_set.count(v_label_in[i]) == 0 )
+            v_vec.push_back(i);
+
+    Graph_ud gt_out(num_vertices(g_in));
+    V_Label vt_label_out;
+
+    build_subgraph(v_vec, g_in, v_label_in, gt_out, vt_label_out);
+ 
+    g_out = gt_out;
+    v_label_out = vt_label_out;
+}
+
+// basic algorithm:
+// HCS( G(V, E) )
+// {
+//   (H, HH, cut) <- min-cut(G)
+//   if ( |cut| >= |V| / 2 )
+//      return V
+//   else
+//   {
+//      HCS(H)
+//      HCS(HH)
+//   }
+// }
+static void HCS_internal(const Graph_ud& g, V_Label& v_label, ClusterResult& clusters)
+{
+    Cluster s_vec, vs_vec;
+    dst cut_capacity = ( num_vertices(g) <= 1 ) ? 0 :
+                       min_cut(g, std::back_inserter(s_vec),
+                               std::back_inserter(vs_vec) );
+
+    if ( v_label.size() <= 0 )
+    {
+#if DEBUG
+        cout << " 0 vertex in the graph: NEED TO LOOK AT THIS " << endl << flush;
+#endif
+    }
+    else if ( v_label.size() <= 1 )
+    {
+        clusters.push_back(v_label);
+
+#if DEBUG
+        cout << " 1 vertex in the graph " << v_label[0] << endl << flush;
+#endif
+    }
+    else if ( ((unsigned int) cut_capacity) >= num_vertices(g) / 2 )
+    {
+        clusters.push_back(v_label);
+
+#if DEBUG
+        cout << "found a highly connected subgraph with "
+        << num_vertices(g) << " vertices: ";
+
+        V_Label::iterator vi;
+        for ( vi = v_label.begin(); vi != v_label.end(); ++vi)
+            cout << *vi << " ";
+
+        cout << endl << flush;
+#endif
+
+    }
+    else
+    {
+        V_Label v_label_out1;
+        V_Label v_label_out2;
+
+        Graph_ud g1(num_vertices(g)), g2(num_vertices(g));
+
+        build_subgraph(s_vec,  g, v_label, g1, v_label_out1);
+        build_subgraph(vs_vec, g, v_label, g2, v_label_out2);
+
+        ClusterResult cluster1, cluster2;
+        HCS_internal(g1, v_label_out1, cluster1);
+        HCS_internal(g2, v_label_out2, cluster2);
+
+        ClusterResult::iterator ci;
+        for ( ci = cluster1.begin(); ci != cluster1.end(); ci++ )
+            clusters.push_back(*ci);
+        for ( ci = cluster2.begin(); ci != cluster2.end(); ci++ )
+            clusters.push_back(*ci);
+    }
+}
+
+// refinements:
+// (1) iterated HCS: handle cases w/ several mincuts in a graph
+// (2) singleton adoption adoption
+// (3) low degree heuristic: eliminate low-degree vertices before HCS
+//
+// final algorithm: (d[1..p]: input int array in decreasing order)
+// HCS_LOOP( G(V, E) )
+// {
+//   for ( i = 1, i <= p, i++ )
+//   {
+//     H <- G;
+//     repeatdly remove all vertices of degree < d_i from H
+//
+//     repeat
+//     {
+//        HCS(H)
+//        perform singletons adoption
+//        remove clustered vertices from H
+//     } until ( no new cluster is found )
+//
+//     remove clusterd vertices from G
+//   }
+// }
+
+static SEXP HCS_loop(Graph_ud& g, V_Label& v_label)
+{
+    unsigned int i, j, nn;
+
+    Graph_ud g1, g2;
+    V_Label v_label_orig1, v_label_orig2;
+
+    ClusterResult clusterG, clusterH, clusterHCS;
+    ClusterResult::iterator ci;
+
+    V_Label::iterator vi;
+
+    for ( i = 0; i < LDV.size(); i++ )
+    {
+        if ( i )
+        {
+            remove_clusters(clusterH, g, v_label, g1, v_label_orig1);
+            g = g1;
+            v_label = v_label_orig1;
+        }
+
+        // COMMENT OUT to test "adopt_singleton"
+        remove_vertices(LDV[i], g, v_label, g1, v_label_orig1);
+        
+        if ( num_vertices(g1) == 0 ) 
+        {
+           g1 = g;
+	   v_label_orig1 = v_label;
+        }
+
+#if DEBUG
+        output_graph(g1, "after removing vertices: ");
+        output_graph_labels(v_label_orig1, "after removing vertices: ");
+#endif
+
+        clusterH.clear();
+
+        while ( num_vertices(g1) )
+        {
+            clusterHCS.clear();
+            HCS_internal(g1, v_label_orig1, clusterHCS);
+
+            adopt_singleton(g1, v_label_orig1, clusterHCS);
+
+            remove_clusters(clusterHCS, g1, v_label_orig1, g2, v_label_orig2);
+            g1 = g2;
+            v_label_orig1 = v_label_orig2;
+
+            for ( j = 0; j < clusterHCS.size(); j++ )
+                clusterH.push_back(clusterHCS[j]);
+        }
+
+        for ( j = 0; j < clusterH.size(); j++ )
+            clusterG.push_back(clusterH[j]);
+    }
+
+    // convert from ClusterResult to SEXP list
+    SEXP ansList, cList;
+    PROTECT(ansList = allocVector(VECSXP,(int)clusterG.size()));
+
+    for ( i = 0, ci = clusterG.begin(); ci != clusterG.end(); i++, ci++ )
+    {
+        // convert one cluster to one SEXP vector
+        nn = (*ci).size();
+        PROTECT(cList = allocVector(INTSXP, nn));
+        for ( j = 0, vi = (*ci).begin(); vi != (*ci).end(); j++, vi++ )
+            INTEGER(cList)[j] = *vi;
+
+        SET_VECTOR_ELT(ansList,i,cList);
+        UNPROTECT(1);
+    }
+
+    UNPROTECT(1);
+    return(ansList);
+}
+
+extern "C"
+{
+
+    // highly-connected-subgraphs: clustering based on graph connectivity
+    SEXP BGL_highly_conn_sg (SEXP num_verts_in, SEXP num_edges_in,
+                             SEXP R_edges_in,   SEXP R_weights_in,
+                             SEXP sat, SEXP lldv, SEXP ldv)
+    {
+        int i, ne;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        // checking of parameters are done in R codes
+        singleton_adoption_threshold = INTEGER(sat)[0];
+        ne = INTEGER(lldv)[0];
+
+        LDV.clear();
+        for ( i = 0; i < ne; i++ ) LDV.push_back(INTEGER(ldv)[i]);
+
+        // assign labels to vertices
+        // "(i+1)*2" is to distinguish label from index (when testing)
+        // "(i+1)" makes the vertex labels the same as those in R graph
+        ne = num_vertices(g);
+        V_Label v_label(ne);
+        for ( i = 0; i < ne; i++ ) v_label[i] = (i+1);
+
+        SEXP ansList = HCS_loop(g, v_label);
+
+        return(ansList);
+    }
+}
+
diff --git a/src/incrConnComp.cpp b/src/incrConnComp.cpp
new file mode 100644
index 0000000..4c616dd
--- /dev/null
+++ b/src/incrConnComp.cpp
@@ -0,0 +1,133 @@
+#include "RBGL.hpp"
+#include <boost/foreach.hpp>
+#include <boost/pending/disjoint_sets.hpp>
+#include <boost/graph/incremental_components.hpp>
+
+extern "C"
+{
+	using namespace boost;
+	using namespace std;
+
+        typedef graph_traits<Graph_ud>::vertex_descriptor Vertex;
+        typedef graph_traits<Graph_ud>::vertices_size_type size_type;
+  
+  typedef graph_traits<Graph_ud>::vertices_size_type VertexIndex;
+
+	typedef Vertex* Parent;
+	typedef size_type* Rank;
+	typedef VertexIndex* Rank;
+
+	static vector<size_type> rrank(1);
+	static vector<Vertex> parent(1);
+	static disjoint_sets<Rank, Parent> ds( &rrank[0], &parent[0]);
+	static bool initialized = false;
+
+	typedef component_index<unsigned int> Components;
+
+	typedef enum {
+		E_IC_INIT_INCREMENTAL_COMPONENT, 
+		E_IC_INCREMENTAL_COMPONENT 
+	} E_IC_METHOD;
+
+    static SEXP BGL_incr_comp_internal(SEXP num_verts_in,
+                SEXP num_edges_in, SEXP R_edges_in, E_IC_METHOD method)
+    {
+	using namespace boost;
+        int NV = INTEGER(num_verts_in)[0] ;
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+	if ( !initialized || method == E_IC_INIT_INCREMENTAL_COMPONENT )
+	{
+	    rrank.clear();   rrank.resize(NV, 0);
+	    parent.clear(); parent.resize(NV, 0);
+
+  	    disjoint_sets<Rank, Parent>  ds1(&rrank[0], &parent[0]);
+  	    ds = ds1;
+	    initialize_incremental_components(g, ds);
+
+	    initialized = true;
+	}
+
+	if ( method == E_IC_INCREMENTAL_COMPONENT )
+	{
+	    incremental_components(g, ds);
+	}
+
+	
+        Components components(parent.begin(), parent.end());
+	unsigned int NC = components.size();
+
+        SEXP anslst, conn, outvec;
+        PROTECT(anslst = allocVector(VECSXP,NC+1));
+	PROTECT(conn = NEW_INTEGER(1));
+
+	INTEGER(conn)[0] = NC;
+	SET_VECTOR_ELT(anslst,0,conn);
+
+	int l;
+
+        int k = 0;
+	BOOST_FOREACH(VertexIndex current_index, components) {
+            l = 0;
+	    // Iterate through the child vertex indices for [current_index]
+	    BOOST_FOREACH(VertexIndex child_index, components[current_index]) {
+                l++;  // determine size of component k
+            }
+            PROTECT(outvec = allocMatrix(INTSXP, 1, l));  // storage for names of component k
+            l = 0;
+	    BOOST_FOREACH(VertexIndex child_index, components[current_index]) {
+                INTEGER(outvec)[l++] =(int) child_index;
+            }
+	    SET_VECTOR_ELT(anslst,k+1,outvec);   // use offset into anslst, top element is NC
+            k = k+1;  // was l+1 seems to be bug
+        }
+
+        UNPROTECT(NC+2);
+        return(anslst);
+    }
+    SEXP BGL_init_incremental_components(SEXP num_verts_in,
+		SEXP num_edges_in, SEXP R_edges_in)
+    {
+        SEXP ans = BGL_incr_comp_internal(num_verts_in,
+                num_edges_in, R_edges_in, 
+		E_IC_INIT_INCREMENTAL_COMPONENT);
+	return(ans);
+    }
+
+    SEXP BGL_incremental_components(SEXP num_verts_in,
+             SEXP num_edges_in, SEXP R_edges_in)
+    {
+        SEXP ans = BGL_incr_comp_internal(num_verts_in,
+                num_edges_in, R_edges_in, 
+		E_IC_INCREMENTAL_COMPONENT);
+	return(ans);
+    }
+
+    SEXP BGL_same_component(SEXP num_verts_in, 
+		    SEXP num_edges_in, SEXP R_edges_in, 
+		    SEXP vert_1, SEXP vert_2)
+    {
+        if ( !initialized )
+           error("graph is not prepared to handle incremental components.");
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+        int NV = INTEGER(num_verts_in)[0];
+	int v1 = INTEGER(vert_1)[0];
+	int v2 = INTEGER(vert_2)[0];
+	
+	bool r = FALSE;
+
+	if ( 0 <= v1 && v1 < NV && 0 <= v2 && v2 < NV )
+	    r = same_component(vertex(v1, g), vertex(v2, g), ds);
+	
+	SEXP conn;
+	PROTECT(conn = NEW_LOGICAL(1));
+	LOGICAL(conn)[0] = r;
+	UNPROTECT(1);
+	return(conn);
+    }
+
+}
+
diff --git a/src/interfaces.cpp b/src/interfaces.cpp
new file mode 100644
index 0000000..418a473
--- /dev/null
+++ b/src/interfaces.cpp
@@ -0,0 +1,403 @@
+#include "RBGL.hpp"
+#include "Basic2DMatrix.hpp"
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/graph/breadth_first_search.hpp>
+#include <boost/graph/topological_sort.hpp>
+#include <boost/graph/strong_components.hpp>
+#include <boost/graph/edge_connectivity.hpp>
+#include <boost/graph/biconnected_components.hpp>
+#include <boost/graph/sequential_vertex_coloring.hpp>
+
+/* need a template with C++ linkage for BFS */
+/* adapted from Siek's bfs-example.cpp */
+
+template < typename TimeMap > class bfs_time_visitor
+    : public boost::default_bfs_visitor {
+    typedef typename boost::property_traits < TimeMap >::value_type T;
+public:
+    bfs_time_visitor(TimeMap tmap, T & t):m_timemap(tmap), m_time(t) { }
+    template < typename Vertex, typename Graph >
+    void discover_vertex(Vertex u, const Graph & g) const
+    {
+        put(m_timemap, u, m_time++);
+    }
+    TimeMap m_timemap;
+    T & m_time;
+};
+
+template < typename TimeMap > class dfs_time_visitor
+    : public boost::default_dfs_visitor {
+    typedef typename boost::property_traits < TimeMap >::value_type T;
+public:
+    dfs_time_visitor(TimeMap dmap, TimeMap fmap, T & t)
+            :  m_dtimemap(dmap), m_ftimemap(fmap), m_time(t) {
+    }
+    template < typename Vertex, typename Graph >
+    void discover_vertex(Vertex u, const Graph & g) const
+    {
+        put(m_dtimemap, u, m_time++);
+    }
+    template < typename Vertex, typename Graph >
+    void finish_vertex(Vertex u, const Graph & g) const
+    {
+        put(m_ftimemap, u, m_time++);
+    }
+    TimeMap m_dtimemap;
+    TimeMap m_ftimemap;
+    T & m_time;
+};
+
+extern "C"
+{
+    SEXP BGL_tsort_D(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in)
+    {
+        // tsortbCG -- for bioConductor graph objects
+
+        using namespace boost;
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in);
+
+        typedef property_map<Graph_dd, vertex_color_t>::type Color;
+        graph_traits<Graph_dd>::vertex_iterator viter, viter_end;
+
+        typedef std::list<Vertex> tsOrder;
+        tsOrder tsord;
+        SEXP tsout;
+
+        PROTECT(tsout = NEW_NUMERIC(INTEGER(num_verts_in)[0]));
+
+        try {
+            topological_sort(g, std::front_inserter(tsord));
+
+            int j = 0;
+            for (tsOrder::iterator i = tsord.begin();
+                    i != tsord.end(); ++i)
+            {
+                REAL(tsout)[j] = (double) *i;
+                j++;
+            }
+        }
+        catch ( not_a_dag )
+        {
+            warning("not a DAG.\n");
+            for (int j = 0 ; j < INTEGER(num_verts_in)[0]; j++)
+                REAL(tsout)[j] = 0.0;
+        }
+        UNPROTECT(1);
+
+        return(tsout);
+    } // end BGL_tsort_D
+
+
+    SEXP BGL_bfs_D(SEXP num_verts_in, SEXP num_edges_in,
+                   SEXP R_edges_in, SEXP R_weights_in, SEXP init_ind)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        typedef graph_traits < Graph_dd >::vertices_size_type size_type;
+
+        const int N = INTEGER(num_verts_in)[0];
+        // Typedefs
+        typedef size_type* Iiter;
+
+        // discover time properties
+        std::vector < size_type > dtime(num_vertices(g));
+
+        size_type time = 0;
+        bfs_time_visitor < size_type * >vis(&dtime[0], time);
+        breadth_first_search(g, vertex((int)INTEGER(init_ind)[0], g), visitor(vis));
+
+
+        // use std::sort to order the vertices by their discover time
+        std::vector < size_type > discover_order(N);
+        integer_range < size_type > r(0, N);
+        std::copy(r.begin(), r.end(), discover_order.begin());
+        std::sort(discover_order.begin(), discover_order.end(),
+                  indirect_cmp < Iiter, std::less < size_type > >(&dtime[0]));
+
+        SEXP disc;
+        PROTECT(disc = allocVector(INTSXP,N));
+
+        int i;
+        for (i = 0; i < N; ++i)
+        {
+            INTEGER(disc)[i] = discover_order[i];
+        }
+
+        UNPROTECT(1);
+        return(disc);
+    }
+
+
+    SEXP BGL_dfs_D(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in,
+                   SEXP R_weights_in)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        typedef graph_traits < Graph_dd >::vertices_size_type size_type;
+
+        const int N = INTEGER(num_verts_in)[0];
+        // Typedefs
+        typedef size_type* Iiter;
+
+        // discover time and finish time properties
+        std::vector < size_type > dtime(num_vertices(g));
+        std::vector < size_type > ftime(num_vertices(g));
+        size_type t = 0;
+        dfs_time_visitor < size_type * >vis(&dtime[0], &ftime[0], t);
+
+        depth_first_search(g, visitor(vis));
+
+        // use std::sort to order the vertices by their discover time
+        std::vector < size_type > discover_order(N);
+        integer_range < size_type > r(0, N);
+        std::copy(r.begin(), r.end(), discover_order.begin());
+        std::sort(discover_order.begin(), discover_order.end(),
+                  indirect_cmp < Iiter, std::less < size_type > >(&dtime[0]));
+        std::vector < size_type > finish_order(N);
+        std::copy(r.begin(), r.end(), finish_order.begin());
+        std::sort(finish_order.begin(), finish_order.end(),
+                  indirect_cmp < Iiter, std::less < size_type > >(&ftime[0]));
+
+        SEXP ansList;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        SEXP disc;
+        PROTECT(disc = allocVector(INTSXP,N));
+        SEXP fin;
+        PROTECT(fin = allocVector(INTSXP,N));
+
+        int i;
+        for (i = 0; i < N; ++i)
+        {
+            INTEGER(disc)[i] = discover_order[i];
+            INTEGER(fin)[i] = finish_order[i];
+        }
+
+        SET_VECTOR_ELT(ansList,0,disc);
+        SET_VECTOR_ELT(ansList,1,fin);
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+    SEXP BGL_connected_components_U (SEXP num_verts_in,
+                                     SEXP num_edges_in, SEXP R_edges_in, 
+				     SEXP R_weights_in )
+    {
+        using namespace boost;
+        SEXP outvec;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        int nvert = INTEGER(num_verts_in)[0] ;
+
+        std::vector<int> component(num_vertices(g));
+        connected_components(g, &component[0]);
+
+        std::vector<int>::size_type k;
+
+        PROTECT(outvec = allocVector(REALSXP,nvert));
+
+        for (k = 0; k < component.size(); k++ )
+            REAL(outvec)[k] = component[k];
+
+        UNPROTECT(1);
+        return(outvec);
+    }
+
+    SEXP BGL_strong_components_D (SEXP num_verts_in,
+                                  SEXP num_edges_in, SEXP R_edges_in,
+                                  SEXP R_weights_in )
+    {
+        using namespace boost;
+        SEXP outvec;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        int nvert = INTEGER(num_verts_in)[0] ;
+
+        std::vector<int> component(num_vertices(g));
+        strong_components(g, &component[0]);
+
+        std::vector<int>::size_type k;
+
+        PROTECT(outvec = allocVector(REALSXP,nvert));
+
+        for (k = 0; k < component.size(); k++ )
+            REAL(outvec)[k] = component[k];
+
+        UNPROTECT(1);
+        return(outvec);
+    }
+
+    SEXP BGL_biconnected_components_U (SEXP num_verts_in,
+                                  SEXP num_edges_in, SEXP R_edges_in,
+                                  SEXP R_weights_in )
+    {
+        using namespace boost;
+        SEXP outvec;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        int ne = INTEGER(num_edges_in)[0] ;
+
+        // this is a bit cheating: use "edge_weight_t" for "edge_component_t"
+        property_map < Graph_ud, edge_weight_t >::type 
+              component = get(edge_weight, g);
+        graph_traits < Graph_ud >::edge_iterator ei, ei_end;
+        for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+            component[*ei] = (int)-1;
+        int num_comps = biconnected_components(g, component);
+
+        SEXP ansList, eList, nc;
+        PROTECT(ansList = allocVector(VECSXP,3));
+        PROTECT(nc = NEW_INTEGER(1));
+        PROTECT(eList = allocMatrix(INTSXP, 2, ne));
+        PROTECT(outvec = allocMatrix(INTSXP, 1, ne));
+
+        INTEGER(nc)[0] = num_comps;
+        int ke = 0;
+        int k = 0;
+        for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+        {
+            INTEGER(eList)[ke++] = (int)source(*ei, g);
+            INTEGER(eList)[ke++] = (int)target(*ei, g);
+            INTEGER(outvec)[k++] = (int)component[*ei];
+        }
+
+        SET_VECTOR_ELT(ansList,0,nc);
+        SET_VECTOR_ELT(ansList,1,eList);
+        SET_VECTOR_ELT(ansList,2,outvec);
+        UNPROTECT(4);
+        return(ansList);
+    }
+
+    SEXP BGL_articulation_points_U (SEXP num_verts_in,
+                                  SEXP num_edges_in, SEXP R_edges_in,
+                                  SEXP R_weights_in )
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        std::vector<Vertex> art_points;
+        articulation_points(g, std::back_inserter(art_points));
+
+        SEXP outvec;
+        PROTECT(outvec = allocVector(INTSXP,art_points.size()));
+
+        for (unsigned int k = 0; k < art_points.size(); k++ )
+            INTEGER(outvec)[k] = art_points[k];
+
+        UNPROTECT(1);
+        return(outvec);
+    }
+
+    SEXP BGL_edge_connectivity_U (SEXP num_verts_in,
+                                  SEXP num_edges_in, SEXP R_edges_in,
+                                  SEXP R_weights_in )
+    {
+        using namespace boost;
+        SEXP ansList, conn, edTmp;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        typedef graph_traits<Graph_ud>::degree_size_type dst;
+        std::vector<Edge> disconnecting_set;
+        std::vector<Edge>::iterator ei;
+        dst c = edge_connectivity( g, std::back_inserter(disconnecting_set) );
+
+        PROTECT(conn = NEW_NUMERIC(1));
+        REAL(conn)[0] = (double)c;
+
+        SEXP eList;
+        PROTECT(ansList = allocVector(VECSXP,2));
+
+        PROTECT(eList = allocVector(VECSXP,(int)c));
+
+        SET_VECTOR_ELT(ansList,0,conn);
+
+        int sind = 0;
+        for (ei = disconnecting_set.begin(); ei != disconnecting_set.end();
+                ++ei)
+        {
+            PROTECT(edTmp = NEW_NUMERIC(2));
+            REAL(edTmp)[0] = (double)source(*ei,g);
+            REAL(edTmp)[1] = (double)target(*ei,g);
+            SET_VECTOR_ELT(eList,sind,edTmp);
+            sind=sind+1;
+            UNPROTECT(1);
+        }
+
+        SET_VECTOR_ELT(ansList,1,eList);
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+    SEXP BGL_sequential_vertex_coloring (SEXP num_verts_in, 
+    		SEXP num_edges_in, SEXP R_edges_in)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        typedef graph_traits < Graph_ud >::vertices_size_type Vertex_Size_Type;
+        typedef property_map < Graph_ud, vertex_index_t >::const_type vertex_index_map;
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+        std::vector<Vertex_Size_Type> color_vec(num_vertices(g));
+        iterator_property_map < Vertex_Size_Type*, vertex_index_map >
+             color(&color_vec.front(), get(vertex_index, g));
+        Vertex_Size_Type n = sequential_vertex_coloring( g, color );
+
+        SEXP ansList, nc, cList;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(nc = NEW_INTEGER(1));
+        PROTECT(cList = allocVector(INTSXP, num_vertices(g)));
+        INTEGER(nc)[0] = (int)n;
+
+        Graph_ud::vertex_iterator vi, v_end;
+        int i = 0;
+        for (tie(vi, v_end) = vertices(g); vi != v_end; ++vi)
+        {
+            INTEGER(cList)[i++] = color_vec[*vi];
+        }
+    
+        SET_VECTOR_ELT(ansList, 0, nc);
+        SET_VECTOR_ELT(ansList, 1, cList);
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+    SEXP BGL_astar_search_D (SEXP num_verts_in, 
+    		SEXP num_edges_in, SEXP R_edges_in )
+    {
+        // TODO: fill in
+    	using namespace boost;
+
+        SEXP ansList;
+        PROTECT(ansList = NEW_INTEGER(1));
+        INTEGER(ansList)[0] = 0;
+        UNPROTECT(1);
+        return(ansList);
+    }
+}
diff --git a/src/minST.cpp b/src/minST.cpp
new file mode 100644
index 0000000..61d240a
--- /dev/null
+++ b/src/minST.cpp
@@ -0,0 +1,114 @@
+#include "RBGL.hpp"
+#include <boost/graph/kruskal_min_spanning_tree.hpp>
+#include <boost/graph/prim_minimum_spanning_tree.hpp>
+
+extern "C"
+{
+
+    SEXP BGL_KMST_D( SEXP num_verts_in, SEXP num_edges_in,
+                     SEXP R_edges_in, SEXP R_weights_in)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+        property_map < Graph_dd, edge_weight_t >::type weight = get(edge_weight, g);
+
+        std::vector < Edge > spanning_tree;
+
+        kruskal_minimum_spanning_tree(g, std::back_inserter(spanning_tree));
+
+        SEXP ansList, ans, answt;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(ans = allocMatrix(INTSXP,2,spanning_tree.size()));
+        PROTECT(answt = allocMatrix(REALSXP,1,spanning_tree.size()));
+        int k = 0, j = 0;
+
+        for (std::vector < Edge >::iterator ei = spanning_tree.begin();
+                ei != spanning_tree.end(); ++ei)
+        {
+            INTEGER(ans)[k++] = source(*ei,g);
+            INTEGER(ans)[k++] = target(*ei,g);
+            REAL(answt)[j++] = weight[*ei];
+        }
+
+        SET_VECTOR_ELT(ansList,0,ans);
+        SET_VECTOR_ELT(ansList,1,answt);
+        UNPROTECT(3);
+        return(ansList);
+    } 
+
+    SEXP BGL_KMST_U( SEXP num_verts_in, SEXP num_edges_in,
+                     SEXP R_edges_in, SEXP R_weights_in)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+        property_map < Graph_ud, edge_weight_t >::type weight = get(edge_weight, g);
+
+        std::vector < Edge > spanning_tree;
+
+        kruskal_minimum_spanning_tree(g, std::back_inserter(spanning_tree));
+
+        SEXP ansList, ans, answt;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(ans = allocMatrix(INTSXP,2,spanning_tree.size()));
+        PROTECT(answt = allocMatrix(REALSXP,1,spanning_tree.size()));
+
+        int k = 0, j = 0;
+        for (std::vector < Edge >::iterator ei = spanning_tree.begin();
+                ei != spanning_tree.end(); ++ei)
+        {
+            INTEGER(ans)[k++] = source(*ei,g);
+            INTEGER(ans)[k++] = target(*ei,g);
+            REAL(answt)[j++] = weight[*ei];
+        }
+
+        SET_VECTOR_ELT(ansList,0,ans);
+        SET_VECTOR_ELT(ansList,1,answt);
+        UNPROTECT(3);
+        return(ansList);
+    } 
+
+    SEXP BGL_PRIM_U( SEXP num_verts_in, SEXP num_edges_in,
+                     SEXP R_edges_in, SEXP R_weights_in)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_ud >::edge_descriptor Edge;
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+	int NV = asInteger(num_verts_in);
+        std::vector <Vertex> parent(NV);
+
+        prim_minimum_spanning_tree(g, &parent[0]);
+
+        property_map<Graph_ud, edge_weight_t>::type weight = get(edge_weight, g);
+
+        SEXP ansList, ans, answt;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(ans = allocMatrix(INTSXP,2,NV));
+        PROTECT(answt = allocMatrix(REALSXP,1,NV));
+
+        int k = 0, j = 0;
+        for (unsigned int v = 0; v < num_vertices(g); ++v)
+	{
+            INTEGER(ans)[k++] = parent[v];
+            INTEGER(ans)[k++] = v;
+            REAL(answt)[j++] = ( parent[v] == v) ? 
+			 0 : get(weight, edge(parent[v], v, g).first);
+	}
+
+        SET_VECTOR_ELT(ansList,0,ans);
+        SET_VECTOR_ELT(ansList,1,answt);
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+}
+
diff --git a/src/mincut.cpp b/src/mincut.cpp
new file mode 100644
index 0000000..27a3527
--- /dev/null
+++ b/src/mincut.cpp
@@ -0,0 +1,188 @@
+#include "RBGL.hpp"
+#include "mincut.hpp"
+#include <boost/graph/edmonds_karp_max_flow.hpp>
+#include <boost/graph/push_relabel_max_flow.hpp>
+#include <boost/graph/boykov_kolmogorov_max_flow.hpp> 
+
+typedef enum { E_MF_Push_Relabel, E_MF_Edmonds_Karp, E_MF_Kolmogorov } E_MF_METHOD;
+
+static SEXP BGL_max_flow_internal(SEXP num_verts_in, SEXP num_edges_in,
+                                  SEXP R_edges_in, SEXP R_capacity_in,
+                                  SEXP src, SEXP sink, E_MF_METHOD method )
+{
+    using namespace boost;
+
+    typedef adjacency_list_traits<vecS, vecS, directedS> Tr;
+    typedef Tr::edge_descriptor Tr_edge_desc;
+
+    typedef adjacency_list<vecS, vecS, directedS, no_property,
+    		property<edge_capacity_t, double,
+    		property<edge_residual_capacity_t, double,
+    		property<edge_reverse_t, Tr_edge_desc> > > >
+		FlowGraph;
+
+    typedef graph_traits<FlowGraph>::edge_iterator   edge_iterator;
+    typedef graph_traits<FlowGraph>::vertex_descriptor vertex_descriptor;
+
+    FlowGraph flow_g;
+
+    property_map < FlowGraph, edge_capacity_t >::type
+    cap = get(edge_capacity, flow_g);
+    property_map < FlowGraph, edge_residual_capacity_t >::type
+    res_cap = get(edge_residual_capacity, flow_g);
+    property_map < FlowGraph, edge_reverse_t >::type
+    rev_edge = get(edge_reverse, flow_g);
+
+    Tr::edge_descriptor e1, e2;
+    bool in1, in2;
+
+    if (!isInteger(R_edges_in)) error("R_edges_in should be integer");
+
+    int NV = INTEGER(num_verts_in)[0];
+    int NE = asInteger(num_edges_in);
+    int* edges_in = INTEGER(R_edges_in);
+    int*    capacity_i = (isReal(R_capacity_in)) ? 0 : INTEGER(R_capacity_in);
+    double* capacity_d = (isReal(R_capacity_in)) ? REAL(R_capacity_in) : 0;
+
+    for (int i = 0; i < NE ; i++, edges_in += 2)
+    {
+        tie(e1, in1) = boost::add_edge(*edges_in, *(edges_in+1), flow_g);
+        tie(e2, in2) = boost::add_edge(*(edges_in+1), *edges_in, flow_g);
+        if ( !in1 || !in2 )
+            error("unable to add edge: (%d, %d)", *edges_in, *(edges_in+1));
+
+        // fill in capacity_map
+        cap[e1] = capacity_i ? (*capacity_i++) : (*capacity_d++);
+        cap[e2] = 0;
+
+        // fill in reverse_edge_map
+        rev_edge[e1] = e2;
+        rev_edge[e2] = e1;
+    }
+
+    double maxflow = 0;
+
+    int vsrc = INTEGER(src)[0];
+    int vsink = INTEGER(sink)[0];
+
+    if ( 0 <= vsrc && vsrc < NV && 0 <= vsink && vsink < NV )
+    {
+    	vertex_descriptor s = vertex(vsrc, flow_g);
+    	vertex_descriptor t = vertex(vsink, flow_g);
+
+    	if ( method == E_MF_Push_Relabel ) 
+	     maxflow = push_relabel_max_flow(flow_g, s, t);
+	else if ( method == E_MF_Edmonds_Karp )
+             maxflow = edmonds_karp_max_flow(flow_g, s, t);
+
+/*
+needs different parameters as of 14 june 2012
+	else if ( method == E_MF_Kolmogorov )
+	{
+//	     error("kolmogorov_max_flow from BGL doesn't work");
+	     maxflow = boykov_kolmogorov_max_flow(flow_g, s, t);
+	}
+*/
+
+	else
+	     error("unknown method for max_flow");
+    }
+
+    SEXP ansList, conn, eList, fList;
+    PROTECT(ansList = allocVector(VECSXP,3));
+    PROTECT(conn = NEW_NUMERIC(1));
+    PROTECT(eList = allocMatrix(INTSXP, 2, asInteger(num_edges_in)));
+    PROTECT(fList = allocMatrix(REALSXP, 1, asInteger(num_edges_in)));
+
+    REAL(conn)[0] = maxflow;
+
+    edge_iterator ei, e_end;
+    int i = 0, j = 0;
+    for (tie(ei, e_end) = edges(flow_g); ei != e_end; ++ei)
+        if (cap[*ei] > 0) {
+            INTEGER(eList)[i++] = source(*ei, flow_g);
+            INTEGER(eList)[i++] = target(*ei, flow_g);
+            REAL(fList)[j++] = cap[*ei] - res_cap[*ei];
+        }
+
+    SET_VECTOR_ELT(ansList,0,conn);
+    SET_VECTOR_ELT(ansList,1,eList);
+    SET_VECTOR_ELT(ansList,2,fList);
+    UNPROTECT(4);
+
+    return(ansList);
+}
+
+extern "C"
+{
+    SEXP BGL_min_cut_U (SEXP num_verts_in, SEXP num_edges_in,
+                        SEXP R_edges_in,   SEXP R_weights_in )
+    {
+        using namespace boost;
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        typedef graph_traits < Graph_ud >::vertex_descriptor Vertex;
+        typedef graph_traits < Graph_ud >::edges_size_type dst;
+        std::vector<Vertex> s_set, vs_set;
+        dst cut_capacity = min_cut(g, std::back_inserter(s_set), std::back_inserter(vs_set) );
+
+        SEXP ansList, conn;
+        SEXP sList, vsList;  // for subsets of nodes in mincut: S, V - S
+
+        PROTECT(ansList = allocVector(VECSXP,3));
+        PROTECT(conn = NEW_NUMERIC(1));
+        PROTECT(sList = allocVector(INTSXP, s_set.size()));
+        PROTECT(vsList = allocVector(INTSXP,vs_set.size()));
+
+        REAL(conn)[0] = (double)cut_capacity;
+
+        std::vector<Vertex>::iterator vi;
+        int i = 0;
+        for ( i = 0, vi = s_set.begin(); vi != s_set.end(); i++, ++vi)
+            INTEGER(sList)[i] = *vi;
+
+        for ( i = 0, vi = vs_set.begin(); vi != vs_set.end(); i++, ++vi)
+            INTEGER(vsList)[i] = *vi;
+
+        SET_VECTOR_ELT(ansList,0,conn);
+        SET_VECTOR_ELT(ansList,1,sList);
+        SET_VECTOR_ELT(ansList,2,vsList);
+        UNPROTECT(4);
+
+        return(ansList);
+    }
+
+
+    SEXP BGL_edmonds_karp_max_flow(SEXP num_verts_in, SEXP num_edges_in,
+                                   SEXP R_edges_in, SEXP R_capacity_in, 
+				   SEXP src, SEXP sink )
+    {
+        SEXP ansList = BGL_max_flow_internal(num_verts_in, num_edges_in,
+                                             R_edges_in, R_capacity_in, 
+					     src, sink, E_MF_Edmonds_Karp);
+        return(ansList);
+    }
+
+    SEXP BGL_push_relabel_max_flow(SEXP num_verts_in, SEXP num_edges_in,
+                                   SEXP R_edges_in, SEXP R_capacity_in, 
+				   SEXP src, SEXP sink )
+    {
+        SEXP ansList = BGL_max_flow_internal(num_verts_in, num_edges_in,
+                                             R_edges_in, R_capacity_in, 
+					     src, sink, E_MF_Push_Relabel);
+        return(ansList);
+    }
+
+    SEXP BGL_kolmogorov_max_flow(SEXP num_verts_in, SEXP num_edges_in,
+                                   SEXP R_edges_in, SEXP R_capacity_in, 
+				   SEXP src, SEXP sink )
+    {
+        SEXP ansList = BGL_max_flow_internal(num_verts_in, num_edges_in,
+                                             R_edges_in, R_capacity_in, 
+					     src, sink, E_MF_Kolmogorov);
+        return(ansList);
+    }
+
+}
+
diff --git a/src/mincut.hpp b/src/mincut.hpp
new file mode 100644
index 0000000..a449010
--- /dev/null
+++ b/src/mincut.hpp
@@ -0,0 +1,110 @@
+#ifndef RBGL_MINCUT_H
+#define RBGL_MINCUT_H
+
+#include <boost/graph/edge_connectivity.hpp>
+
+namespace boost 
+{
+
+template < typename VertexListGraph, typename OutputIterator >
+typename graph_traits<VertexListGraph>::edges_size_type
+min_cut(VertexListGraph & g, OutputIterator s_set, OutputIterator vs_set)
+{
+    typedef graph_traits<VertexListGraph> Traits;
+    typedef typename Traits::vertex_descriptor vertex_descriptor;
+    typedef typename Traits::vertex_iterator   vertex_iterator;
+    typedef typename Traits::degree_size_type  degree_size_type;
+    typedef typename Traits::edge_iterator     edge_iterator;
+    typedef typename Traits::edges_size_type   edges_size_type;
+
+    typedef color_traits<default_color_type> Color;
+
+    typedef adjacency_list_traits<vecS, vecS, directedS> Tr;
+    typedef typename Tr::edge_descriptor Tr_edge_desc;
+    typedef adjacency_list<vecS, vecS, directedS, no_property,
+	          property<edge_capacity_t, degree_size_type,
+	          property<edge_residual_capacity_t, degree_size_type,
+	          property<edge_reverse_t, Tr_edge_desc> > > >
+	    FlowGraph;
+    typedef typename graph_traits<FlowGraph>::edge_descriptor edge_descriptor;
+
+    vertex_descriptor u, v, p, k;
+    vertex_iterator vi, vi_end;
+    edge_descriptor e1, e2;
+    edge_iterator ei, ei_end;
+    edges_size_type delta, alpha_star, alpha_S_k;
+    bool inserted;
+
+    std::set < vertex_descriptor > S, neighbor_S;
+    std::vector < vertex_descriptor > S_star, nonneighbor_S;
+    std::vector < default_color_type > color(num_vertices(g));
+    std::vector < edge_descriptor > pred(num_vertices(g));
+
+    FlowGraph flow_g(num_vertices(g));
+    typename property_map < FlowGraph, edge_capacity_t >::type
+             cap = get(edge_capacity, flow_g);
+    typename property_map < FlowGraph, edge_residual_capacity_t >::type
+             res_cap = get(edge_residual_capacity, flow_g);
+    typename property_map < FlowGraph, edge_reverse_t >::type
+             rev_edge = get(edge_reverse, flow_g);
+
+    // This loop is to convert undirected graph to directed graph, 
+    // each edge in undirected graph has unit capacity 
+    // each arc in directed graph also has unit capacity 
+    for (tie(ei, ei_end) = edges(g); ei != ei_end; ++ei) {
+        u = source(*ei, g), v = target(*ei, g);
+        tie(e1, inserted) = add_edge(u, v, flow_g);
+        cap[e1] = 1;
+        tie(e2, inserted) = add_edge(v, u, flow_g);
+        cap[e2] = 1;
+        rev_edge[e1] = e2;
+        rev_edge[e2] = e1;
+    }
+
+    tie(p, delta) = detail::min_degree_vertex(g);
+    S_star.push_back(p);
+    alpha_star = delta;
+    S.insert(p);
+    neighbor_S.insert(p);
+    detail::neighbors(g, S.begin(), S.end(),
+              std::inserter(neighbor_S, neighbor_S.begin()));
+    std::set_difference(vertices(g).first, vertices(g).second,
+                        neighbor_S.begin(), neighbor_S.end(),
+                        std::back_inserter(nonneighbor_S));
+
+    while (!nonneighbor_S.empty()) {
+        k = nonneighbor_S.front();
+        alpha_S_k = edmonds_karp_max_flow
+                    (flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]);
+        if (alpha_S_k < alpha_star) {
+            alpha_star = alpha_S_k;
+            S_star.clear();
+            for (tie(vi, vi_end) = vertices(flow_g); vi != vi_end; ++vi)
+                if (color[*vi] != Color::white())
+                    S_star.push_back(*vi);
+        }
+        S.insert(k);
+        neighbor_S.insert(k);
+	detail::neighbors(g, k, std::inserter(neighbor_S, neighbor_S.begin()));
+        nonneighbor_S.clear();
+        std::set_difference(vertices(g).first, vertices(g).second,
+                            neighbor_S.begin(), neighbor_S.end(),
+                            std::back_inserter(nonneighbor_S));
+    }
+
+    /* To extract mincut sets: S and (V - S) */
+    std::vector < bool > in_S_star(num_vertices(g), false);
+    typename std::vector < vertex_descriptor >::iterator si;
+    for (si = S_star.begin(); si != S_star.end(); ++si)
+          in_S_star[*si] = true;
+    
+    for (tie(vi, vi_end) = vertices(flow_g); vi != vi_end; ++vi)
+	  if ( in_S_star[*vi] ) *s_set++ = *vi; 
+          else *vs_set++ = *vi; 
+
+    return alpha_star;
+}
+
+}
+#endif  // RBGL_MINCUT_H
+
diff --git a/src/ordering.cpp b/src/ordering.cpp
new file mode 100644
index 0000000..35cbe61
--- /dev/null
+++ b/src/ordering.cpp
@@ -0,0 +1,282 @@
+#include "RBGL.hpp"
+#include <boost/graph/isomorphism.hpp>
+#include <boost/graph/cuthill_mckee_ordering.hpp>
+#include <boost/graph/bandwidth.hpp>
+#include <boost/graph/profile.hpp>
+#include <boost/graph/wavefront.hpp>
+#include <boost/graph/minimum_degree_ordering.hpp>
+#include <boost/graph/sloan_ordering.hpp>
+#include <boost/graph/king_ordering.hpp>
+
+extern "C"
+{
+	// These are more easily done in R alone, no point to use BGL
+	// copy_graph
+	// transpose_graph
+
+	SEXP BGL_isomorphism(
+		SEXP num_verts_in1, SEXP num_edges_in1, SEXP R_edges_in1,  
+		SEXP num_verts_in2, SEXP num_edges_in2, SEXP R_edges_in2
+			 )
+	{
+		using namespace boost;
+
+		bool r = FALSE;
+
+		const int NV1 = asInteger(num_verts_in1);
+		const int NV2 = asInteger(num_verts_in2);
+		const int NE1 = asInteger(num_edges_in1);
+		const int NE2 = asInteger(num_edges_in2);
+
+		if ( NV1 == NV2 )
+		{
+		typedef adjacency_list < vecS, listS, undirectedS,
+			property < vertex_index_t, int> > VEGraph;
+
+		VEGraph g1(NV1), g2(NV2);
+
+		std::vector<graph_traits<VEGraph>::vertex_descriptor> v1(NV1), v2(NV2);
+		property_map<VEGraph, vertex_index_t>::type
+			v1_index_map = get(vertex_index, g1),
+			v2_index_map = get(vertex_index, g2);
+
+		graph_traits<VEGraph>::vertex_iterator i, end;
+		int id = 0;
+		for (tie(i, end) = vertices(g1); i != end; ++i, ++id) 
+		{
+		      put(v1_index_map, *i, id);
+		      v1[id] = *i;
+		}
+		id = 0;
+		for (tie(i, end) = vertices(g2); i != end; ++i, ++id) 
+		{
+		      put(v2_index_map, *i, id);
+		      v2[id] = *i;
+		}
+		
+		int* edges_in = INTEGER(R_edges_in1);
+		for ( int i = 0; i < NE1; i++, edges_in += 2 )
+			add_edge(v1[*edges_in], v1[*(edges_in+1)], g1);
+		
+		edges_in = INTEGER(R_edges_in2);
+		for ( int i = 0; i < NE2; i++, edges_in += 2 )
+			add_edge(v2[*edges_in], v2[*(edges_in+1)], g2);
+		
+		std::vector<graph_traits<VEGraph>::vertex_descriptor> f(NV1);
+
+		r = isomorphism(g1, g2, isomorphism_map 
+			(make_iterator_property_map(f.begin(), v1_index_map, f[0])));
+		}
+
+		SEXP ansList, conn;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(conn = NEW_LOGICAL(1));
+
+		LOGICAL(conn)[0] = r;
+
+		SET_VECTOR_ELT(ansList,0,conn);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_cuthill_mckee_ordering(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in)
+	{
+		using namespace boost;
+
+		typedef graph_traits<Graph_ud>::vertex_descriptor Vertex;
+		typedef graph_traits<Graph_ud>::vertices_size_type size_type;
+
+		const int N = asInteger(num_verts_in);
+		std::vector<Vertex>    inv_perm(N);
+		std::vector<size_type> perm(N);
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		cuthill_mckee_ordering(g, inv_perm.rbegin(), get(vertex_color, g), make_degree_map(g));
+
+		SEXP ansList, invpermList, robw, rbw;
+		PROTECT(ansList = allocVector(VECSXP,3));
+		PROTECT(invpermList = allocVector(INTSXP,N));
+		PROTECT(robw = NEW_INTEGER(1));
+		PROTECT(rbw = NEW_INTEGER(1));
+
+		property_map<Graph_ud, vertex_index_t>::type index_map = get(vertex_index, g);
+		std::vector<Vertex>::const_iterator i;
+		int j = 0;
+
+		for ( i = inv_perm.begin(); i != inv_perm.end(); i++ )
+			INTEGER(invpermList)[j++] = index_map[*i];
+		for ( size_type c = 0; c != inv_perm.size(); ++c )
+			perm[index_map[inv_perm[c]]] = c;
+
+		INTEGER(robw)[0] = bandwidth(g);
+		INTEGER(rbw)[0] = bandwidth(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+
+		SET_VECTOR_ELT(ansList,0,invpermList);
+		SET_VECTOR_ELT(ansList,1,robw);
+		SET_VECTOR_ELT(ansList,2,rbw);
+
+		UNPROTECT(4);
+		return(ansList);
+	}
+
+	SEXP BGL_min_degree_ordering(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in,   SEXP R_delta)
+	{
+		using namespace boost;
+
+		int delta = asInteger(R_delta);
+		const int NV = asInteger(num_verts_in);
+		typedef graph_traits<Graph_dd>::vertex_descriptor Vertex;
+		Graph_dd g(num_verts_in, num_edges_in, R_edges_in);
+		std::vector<int> inverse_perm(NV, 0);
+		std::vector<int> perm(NV, 0);
+		std::vector<int> degree(NV, 0);
+		std::vector<int> supernode_sizes(NV, 1);
+		property_map<Graph_dd, vertex_index_t>::type id = get(vertex_index, g);
+
+		minimum_degree_ordering(g, 
+			make_iterator_property_map(&degree[0], id, degree[0]), 
+			&inverse_perm[0], 
+			&perm[0], 
+			make_iterator_property_map(&supernode_sizes[0], id, supernode_sizes[0]), 
+			delta, id);
+
+		SEXP ansList, invpermList, permList;
+		PROTECT(ansList = allocVector(VECSXP,2));
+		PROTECT(invpermList = allocVector(INTSXP,NV));
+		PROTECT(permList = allocVector(INTSXP,NV));
+
+		std::vector<int>::const_iterator i;
+		int j = 0;
+
+		for ( i = inverse_perm.begin(); i != inverse_perm.end(); i++ )
+			INTEGER(invpermList)[j++] = inverse_perm[*i];
+
+		j = 0;
+		for ( i = perm.begin(); i != perm.end(); i++ )
+			INTEGER(permList)[j++] = perm[*i];
+
+		SET_VECTOR_ELT(ansList,0,invpermList);
+		SET_VECTOR_ELT(ansList,1,permList);
+		UNPROTECT(3);
+		return(ansList);
+	}
+
+	SEXP BGL_king_ordering(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in,   SEXP R_delta)
+	{
+		using namespace boost;
+
+		//int delta = asInteger(R_delta);
+		const int NV = asInteger(num_verts_in);
+		typedef graph_traits<Graph_dd>::vertex_descriptor Vertex;
+		Graph_dd g(num_verts_in, num_edges_in, R_edges_in);
+		std::vector<int> inverse_perm(NV, 0);
+		std::vector<int> perm(NV, 0);
+		std::vector<int> degree(NV, 0);
+		std::vector<int> supernode_sizes(NV, 1);
+		property_map<Graph_dd, vertex_index_t>::type id = get(vertex_index, g);
+
+                // TODO: fill in
+/*
+		king_ordering(g, 
+			make_iterator_property_map(&degree[0], id, degree[0]), 
+			&inverse_perm[0], 
+			&perm[0], 
+			make_iterator_property_map(&supernode_sizes[0], id, supernode_sizes[0]), 
+			delta, id);
+*/
+
+		SEXP ansList, invpermList, permList;
+		PROTECT(ansList = allocVector(VECSXP,2));
+		PROTECT(invpermList = allocVector(INTSXP,NV));
+		PROTECT(permList = allocVector(INTSXP,NV));
+
+		std::vector<int>::const_iterator i;
+		int j = 0;
+
+		for ( i = inverse_perm.begin(); i != inverse_perm.end(); i++ )
+			INTEGER(invpermList)[j++] = inverse_perm[*i];
+
+		j = 0;
+		for ( i = perm.begin(); i != perm.end(); i++ )
+			INTEGER(permList)[j++] = perm[*i];
+
+		SET_VECTOR_ELT(ansList,0,invpermList);
+		SET_VECTOR_ELT(ansList,1,permList);
+		UNPROTECT(3);
+		return(ansList);
+	}
+
+	SEXP BGL_sloan_ordering(SEXP num_verts_in, SEXP num_edges_in,
+                     SEXP R_edges_in, SEXP R_W1, SEXP R_W2 )
+	{
+		using namespace boost;
+
+		const int NV = asInteger(num_verts_in);
+		const int NE = asInteger(num_edges_in);
+		const int W1 = asInteger(R_W1);
+		const int W2 = asInteger(R_W2);
+
+		typedef adjacency_list< setS, vecS, undirectedS, 
+		    property< vertex_color_t, default_color_type,
+		    property< vertex_degree_t, int,
+		    property< vertex_priority_t, double > > > > IGraph;
+
+		typedef graph_traits<IGraph>::vertex_descriptor Vertex;
+		typedef graph_traits<IGraph>::vertices_size_type size_type;
+		typedef std::pair<std::size_t, std::size_t> Pair;
+
+		IGraph g(NV);
+
+		int* edges_in = INTEGER(R_edges_in);
+		for ( int i = 0; i < NE; i++, edges_in += 2 )
+			add_edge(*edges_in, *(edges_in+1), g);
+		
+		property_map<IGraph, vertex_index_t>::type index_map = get(vertex_index, g);
+
+		std::vector<Vertex>    sloan_order(NV);
+		std::vector<size_type> perm(NV);
+
+		sloan_ordering(g, sloan_order.begin(), get(vertex_color, g), 
+			make_degree_map(g), get(vertex_priority, g), W1, W2);
+
+		SEXP ansList, sList, rbw, rpf, rmw, raw, rrw;
+		PROTECT(ansList = allocVector(VECSXP,6));
+		PROTECT(sList = allocVector(INTSXP,NV));
+		PROTECT(rbw = NEW_INTEGER(1));
+		PROTECT(rpf = NEW_INTEGER(1));
+		PROTECT(rmw = NEW_INTEGER(1));
+		PROTECT(raw = NEW_NUMERIC(1));
+		PROTECT(rrw = NEW_NUMERIC(1));
+
+		std::vector<Vertex>::const_iterator i;
+		int j = 0;
+
+		for ( i = sloan_order.begin(); i != sloan_order.end(); i++ )
+			INTEGER(sList)[j++] = index_map[*i];
+
+		for ( size_type c = 0; c != sloan_order.size(); ++c )
+			perm[index_map[sloan_order[c]]] = c;
+
+		INTEGER(rbw)[0] = bandwidth(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+		INTEGER(rpf)[0] = profile(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+		INTEGER(rmw)[0] = max_wavefront(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+		REAL(raw)[0] = aver_wavefront(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+		REAL(rrw)[0] = rms_wavefront(g, make_iterator_property_map(&perm[0], index_map, perm[0]));
+
+		SET_VECTOR_ELT(ansList,0,sList);
+		SET_VECTOR_ELT(ansList,1,rbw);
+		SET_VECTOR_ELT(ansList,2,rpf);
+		SET_VECTOR_ELT(ansList,3,rmw);
+		SET_VECTOR_ELT(ansList,4,raw);
+		SET_VECTOR_ELT(ansList,5,rrw);
+
+		UNPROTECT(7);
+		return(ansList);
+	}
+
+}
+
diff --git a/src/planar.cpp b/src/planar.cpp
new file mode 100644
index 0000000..b1fcea7
--- /dev/null
+++ b/src/planar.cpp
@@ -0,0 +1,724 @@
+#include "RBGL.hpp"
+
+#include <boost/graph/boyer_myrvold_planar_test.hpp>
+#include <boost/graph/planar_face_traversal.hpp>
+#include <boost/graph/planar_canonical_ordering.hpp>
+#include <boost/graph/chrobak_payne_drawing.hpp>
+#include <boost/graph/is_kuratowski_subgraph.hpp>
+#include <boost/graph/make_connected.hpp>
+#include <boost/graph/make_biconnected_planar.hpp>
+#include <boost/graph/make_maximal_planar.hpp>
+#include <boost/graph/max_cardinality_matching.hpp>
+
+// NOTE: 
+//    this "undef" is to avoid following conflict:
+// in boost: boost/tuple/tuple.hpp:get(tuples::cons<HT, TT>& c)
+// in R:     Rinternals.h: #define cons                  Rf_cons
+#undef cons
+#include <boost/graph/is_straight_line_drawing.hpp>
+
+using namespace boost;
+
+// Note: if these are inside planarFaceTraversal, it causes major 
+//      hiccups in g++, this could be reproduced in the example codes
+/////////////////////////////////////////////////////////////////////
+template <typename Vertex, typename Edge>
+struct my_output_visitor : public planar_face_traversal_visitor
+{
+  my_output_visitor(): v_vis(0), f_vis(0) { }
+  ~my_output_visitor() 		{ }
+  void begin_face() 		{ v_vis.clear(); }
+  void end_face() 		{ f_vis.push_back(v_vis); }
+  void next_vertex(Vertex v) 	{ v_vis.push_back(v); }
+
+  typedef std::vector< Vertex > v_vis_t;
+  v_vis_t v_vis;
+  std::vector< v_vis_t > f_vis;
+};
+
+template<typename Graph, typename Vertex>
+struct my_add_edge_visitor : public default_add_edge_visitor
+{
+   void visit_vertex_pair(Vertex u, Vertex v, Graph& g)
+   {
+        add_edge(u, v, g);
+//        std::cout << " add edge: " << u << " " << v << std::endl;
+        e_vis.push_back(std::make_pair(u, v));
+   }
+
+   typedef std::vector< std::pair< Vertex, Vertex> > e_vis_t;
+   e_vis_t e_vis;
+};
+
+//////////////////////////////////////////////////////////////////////
+//a class to hold the coordinates of the straight line embedding
+struct coord_t
+{
+  std::size_t x;
+  std::size_t y;
+};
+
+//////////////////////////////////////////////////////////////////////
+
+extern "C"
+{
+    typedef adjacency_list
+    	       < vecS, vecS, undirectedS,
+      	         property<vertex_index_t, int>,
+      	         property<edge_index_t, int>
+    	       > planarGraph;
+
+    typedef graph_traits<planarGraph>::vertex_descriptor Vertex;
+    typedef graph_traits<planarGraph>::edge_descriptor Edge;
+
+    typedef property_map<planarGraph, vertex_index_t>::type Vertex_Index_t;
+    typedef property_map<planarGraph, edge_index_t>::type Edge_Index_t;
+
+    typedef std::vector<Vertex> Vertex_Vec_t;
+
+    typedef std::vector< Edge > Edge_Vec_t;
+    typedef std::vector< Edge_Vec_t > embedding_storage_t;
+    typedef boost::iterator_property_map
+    	    < embedding_storage_t::iterator, Vertex_Index_t > embedding_t;
+
+    typedef std::vector< coord_t > Coord_Vec_t;
+    typedef boost::iterator_property_map
+   	    < Coord_Vec_t::iterator, Vertex_Index_t > straight_line_drawing_t;
+
+    Edge_Index_t 	e_index;
+    Coord_Vec_t 	straight_line_drawing_storage(0);
+    embedding_storage_t embedding_storage(0);
+
+    graph_traits<planarGraph>::edges_size_type 	edge_count;
+    graph_traits<planarGraph>::edge_iterator 	ei, ei_end;
+    graph_traits<planarGraph>::vertex_iterator 	vi, vi_end;
+
+     void initPlanarGraph(planarGraph* g,
+			    SEXP num_verts_in,
+                            SEXP num_edges_in,
+                            SEXP R_edges_in)
+     {
+        if ( !isInteger(R_edges_in) ) error("R_edges_in should be integer");
+
+        int NE = asInteger(num_edges_in);
+        int* edges_in = INTEGER(R_edges_in);
+
+        for (int i = 0; i < NE ; i++, edges_in += 2) 
+	{
+            boost::add_edge(*edges_in, *(edges_in+1), 1, *g);
+        }
+     }
+
+     SEXP boyerMyrvoldPlanarityTest(SEXP num_verts_in, 
+			SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+	SEXP ans;
+	PROTECT(ans = NEW_INTEGER(1));
+
+	INTEGER(ans)[0] = boyer_myrvold_planarity_test(g);
+
+	UNPROTECT(1);
+	return ans;
+     }
+
+     SEXP planarFaceTraversal(SEXP num_verts_in, 
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+	// Initialize the interior edge index
+	e_index = get(edge_index, g);
+	edge_count = 0;
+	for ( tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+	    put(e_index, *ei, edge_count++);
+
+  	embedding_storage.clear(); 
+	embedding_storage.resize(num_vertices(g));
+
+  	if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::embedding = &embedding_storage[0]) )
+  	{
+  	   my_output_visitor<Vertex, Edge> v_vis;
+  	   planar_face_traversal(g, &embedding_storage[0], v_vis);
+
+//#if RBGL_DEBUG 
+//  	   std::cout << "we get the following: " << std::endl;
+//  	   for ( int i = 0; i < v_vis.f_vis.size(); i++ )
+//  	   {
+//   	      for ( int j = 0; j < v_vis.f_vis[i].size(); j++ )
+//      	         std::cout << v_vis.f_vis[i][j] << " ";
+//    	      std::cout << std::endl;
+//  	   }
+//#endif 
+           SEXP ans, ansList;
+           PROTECT(ansList = allocVector(VECSXP,v_vis.f_vis.size()));
+
+           for ( int i = 0; i < v_vis.f_vis.size(); i++ )
+           {
+                PROTECT(ans = allocVector(INTSXP, v_vis.f_vis[i].size()));
+
+                for ( int j = 0; j < v_vis.f_vis[i].size(); j++ )
+                    INTEGER(ans)[j] = v_vis.f_vis[i][j];
+
+                SET_VECTOR_ELT(ansList,i, ans);
+           }
+
+           UNPROTECT(1+v_vis.f_vis.size());
+           return ansList;
+  	}
+  	else
+	{
+//       	   std::cout << "Input graph is not planar" << std::endl;
+
+           SEXP ans;
+           PROTECT(ans = NEW_INTEGER(1));
+
+           INTEGER(ans)[0] = 0;
+
+           UNPROTECT(1);
+           return ans;
+	}
+     }
+
+     SEXP planarCanonicalOrdering(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+        // Initialize the interior edge index
+	e_index = get(edge_index, g);
+        edge_count = 0;
+        for ( tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+            put(e_index, *ei, edge_count++);
+
+  	embedding_storage.clear(); 
+	embedding_storage.resize(num_vertices(g));
+
+  	embedding_t embedding(embedding_storage.begin(), get(vertex_index,g));
+
+        if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::embedding = embedding) )
+        {
+           my_add_edge_visitor<planarGraph, Vertex> e1_vis;
+
+           make_connected(g, get(vertex_index, g), e1_vis);
+
+           make_biconnected_planar(g, &embedding_storage[0],
+                        get(edge_index, g), e1_vis);
+	
+           my_add_edge_visitor<planarGraph, Vertex> e_vis;
+           make_maximal_planar(g, &embedding_storage[0],
+                        get(vertex_index, g), get(edge_index, g), e_vis);
+
+	   // input has to be maximal planar graph with 2+ nodes
+  	   Vertex_Vec_t ordering;
+  	   planar_canonical_ordering(g, embedding, std::back_inserter(ordering));
+
+//#if RBGL_DEBUG
+  	   Vertex_Vec_t::iterator oi, oi_end = ordering.end();
+//  	   std::cout << "The planar canonical ordering is: ";
+//
+//  	   for ( oi = ordering.begin(); oi != oi_end; ++oi)
+//    	       std::cout << *oi << " ";
+//  	   std::cout << std::endl;
+//
+  	   straight_line_drawing_storage.clear(); straight_line_drawing_storage.resize(num_vertices(g));
+  	   straight_line_drawing_t straight_line_drawing
+    		   (straight_line_drawing_storage.begin(), get(vertex_index,g));
+//
+  	   // Compute the straight line drawing
+  	   chrobak_payne_straight_line_drawing(g,  
+                                      embedding,
+                                      ordering.begin(),
+                                      ordering.end(),
+                                      straight_line_drawing);
+//
+//  	   std::cout << "The straight line drawing is: " << std::endl;
+//  	   for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi)
+//    	   {
+//      	      std::cout << *vi << " -> (" 
+//		   << straight_line_drawing[*vi].x << ", " 
+//		   << straight_line_drawing[*vi].y << ")" 
+//		   << std::endl;
+//    	   }
+//#endif
+
+	   SEXP ans;
+	   PROTECT(ans = allocVector(INTSXP, ordering.size()));
+
+	   for ( int i = 0; i < ordering.size(); i++ )
+	      INTEGER(ans)[i] = ordering[i];
+
+	   UNPROTECT(1);
+	   return ans;
+	}
+	else
+	{
+//	   std::cout << "Input graph is not planar" << std::endl;
+
+	   SEXP ans;
+	   PROTECT(ans = NEW_INTEGER(1));
+
+	   INTEGER(ans)[0] = 0;
+
+	   UNPROTECT(1);
+	   return ans;
+	}
+     }
+
+     SEXP chrobakPayneStraightLineDrawing(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+  	embedding_storage.clear(); embedding_storage.resize(num_vertices(g));
+  	embedding_t embedding(embedding_storage.begin(), get(vertex_index,g));
+
+	// input must be maximal planar graph with 3+ vertices
+  	if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::embedding = embedding) )
+	{
+           my_add_edge_visitor<planarGraph, Vertex> e1_vis;
+
+           make_connected(g, get(vertex_index, g), e1_vis);
+
+           make_biconnected_planar(g, &embedding_storage[0],
+                        get(edge_index, g), e1_vis);
+
+           my_add_edge_visitor<planarGraph, Vertex> e_vis;
+           make_maximal_planar(g, &embedding_storage[0],
+                        get(vertex_index, g), get(edge_index, g), e_vis);
+
+  	   std::vector< Vertex > ordering;
+  	   planar_canonical_ordering(g, embedding, std::back_inserter(ordering));
+
+  	   // property map to hold the mapping from vertices to coord_t's
+  	   straight_line_drawing_storage.clear(); 
+	   straight_line_drawing_storage.resize(num_vertices(g));
+  	   straight_line_drawing_t straight_line_drawing
+        	   (straight_line_drawing_storage.begin(), get(vertex_index,g));
+
+  	   // Compute the straight line drawing
+  	   chrobak_payne_straight_line_drawing(g, 
+                                      embedding, 
+                                      ordering.begin(),
+                                      ordering.end(),
+                                      straight_line_drawing);
+
+//#if RBGL_DEBUG
+//  	   std::cout << "The straight line drawing is: " << std::endl;
+//  	   for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi)
+//    	   {
+//      	      std::cout << *vi << " -> (" 
+//		<< straight_line_drawing[*vi].x << ", " 
+//		<< straight_line_drawing[*vi].y << ")" 
+//                << std::endl;
+//    	   }
+//#endif
+
+	   SEXP ans;
+	   PROTECT(ans = allocMatrix(INTSXP, 2, num_vertices(g)));
+
+	   int j = 0;
+  	   for(tie(vi,vi_end) = vertices(g); vi != vi_end; ++vi)
+	   {
+	      INTEGER(ans)[j++] = straight_line_drawing[*vi].x;
+	      INTEGER(ans)[j++] = straight_line_drawing[*vi].y;
+	   }
+
+	   UNPROTECT(1);
+	   return ans;
+	}
+	else
+	{
+//	   std::cout << "Input graph is not planar" << std::endl;
+
+	   SEXP ans;
+	   PROTECT(ans = NEW_INTEGER(1));
+
+	   INTEGER(ans)[0] = 0;
+
+	   UNPROTECT(1);
+	   return ans;
+	}
+     }
+
+     SEXP isStraightLineDrawing(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in,
+			SEXP drawing_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+ 
+	bool rstl;
+
+  	straight_line_drawing_storage.clear(); 
+	straight_line_drawing_storage.resize(num_vertices(g)); 
+  	straight_line_drawing_t straight_line_drawing 
+		(straight_line_drawing_storage.begin(), get(vertex_index,g) );
+
+	for ( int i = 0, j = 0; i < num_vertices(g); i++ )
+	{
+	   straight_line_drawing[i].x = INTEGER(drawing_in)[j++];
+	   straight_line_drawing[i].y = INTEGER(drawing_in)[j++];
+//      	    std::cout << i << " -> (" 
+//		<< straight_line_drawing[i].x << ", " 
+//		<< straight_line_drawing[i].y << ")"
+//                << std::endl;
+	}
+
+  	// Verify that the drawing is actually a plane drawing
+  	if (is_straight_line_drawing(g, straight_line_drawing))
+	{
+//    		std::cout << "Is a plane drawing." << std::endl;
+		rstl = 1;
+	}
+  	else
+	{
+//    		std::cout << "Is not a plane drawing." << std::endl;
+		rstl = 0;
+	}
+
+	SEXP ans;
+	PROTECT(ans = NEW_INTEGER(1));
+
+	INTEGER(ans)[0] = rstl;
+	UNPROTECT(1);
+	return ans;
+     }
+
+     SEXP isKuratowskiSubgraph(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+  	// Initialize the interior edge index
+	e_index = get(edge_index, g);
+  	edge_count = 0;
+  	for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+    		put(e_index, *ei, edge_count++);
+  
+	bool is_planar = 0, is_kuratowski = 0;
+
+  	Edge_Vec_t kuratowski_edges;
+  	if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::kuratowski_subgraph = 
+                                       std::back_inserter(kuratowski_edges)) )
+	{
+	   is_planar = 1;
+//    	   std::cout << "Input graph is planar" << std::endl;
+	}
+  	else
+    	{
+	   is_planar = 0;
+//      	   std::cout << "Input graph is not planar" << std::endl;
+
+//      	   std::cout << "Edges in the Kuratowski subgraph: ";
+
+      	   Edge_Vec_t::iterator ki, ki_end = kuratowski_edges.end();
+//      	   for ( ki = kuratowski_edges.begin(); ki != ki_end; ++ki )
+//              std::cout << *ki << " "; 
+//      	   std::cout << std::endl;
+//
+//      	   std::cout << "Is a kuratowski subgraph? ";
+      	   if (is_kuratowski_subgraph(g, kuratowski_edges.begin(), kuratowski_edges.end()))
+	   {
+ //             std::cout << "Yes." << std::endl;
+	      is_kuratowski = 1;
+	   }
+      	   else
+	   {
+//              std::cout << "No." << std::endl;
+	      is_kuratowski = 0;
+	   }
+    	}
+
+	SEXP ans1, ans2, k_vec, ansList;
+
+	PROTECT(ansList = allocVector(VECSXP,3));
+
+	PROTECT(ans1 = NEW_INTEGER(1));
+	INTEGER(ans1)[0] = is_planar;
+	SET_VECTOR_ELT(ansList,0,ans1);
+
+	PROTECT(ans2 = NEW_INTEGER(1));
+	INTEGER(ans2)[0] = is_kuratowski;
+	SET_VECTOR_ELT(ansList,1,ans2);
+
+	PROTECT(k_vec = allocMatrix(INTSXP, 2, kuratowski_edges.size()));
+
+	int i, j = 0;
+	Edge_Vec_t::iterator ki, ki_end = kuratowski_edges.end();
+  	for ( ki = kuratowski_edges.begin(); ki != ki_end; ++ki )
+	{
+	      INTEGER(k_vec)[j++] = source(*ki, g);
+	      INTEGER(k_vec)[j++] = target(*ki, g);
+	}
+
+	SET_VECTOR_ELT(ansList,2, k_vec);
+
+	UNPROTECT(4);
+	return ansList;
+     }
+
+     SEXP makeConnected(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+	my_add_edge_visitor<planarGraph, Vertex> e_vis;
+
+	make_connected(g, get(vertex_index, g), e_vis);
+
+//  	for ( int i = 0; i < e_vis.e_vis.size(); i++ )
+//  	{
+//            std::cout << e_vis.e_vis[i].first << " "
+//                  << e_vis.e_vis[i].second
+//                  << std::endl;
+//  	}
+
+	// output is a graph
+	SEXP ans;
+	PROTECT(ans = allocMatrix(INTSXP, 2, num_edges(g)));
+
+	int i;
+  	for( i = 0, tie(ei, ei_end) = edges(g); ei != ei_end; ++ei )
+	{
+	   INTEGER(ans)[i++] = source(*ei, g);
+	   INTEGER(ans)[i++] = target(*ei, g);
+	}
+
+	UNPROTECT(1);
+	return ans;
+     }
+
+     SEXP makeBiconnectedPlanar(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+  	//Initialize the interior edge index
+	e_index = get(edge_index, g);
+  	edge_count = 0;
+  	for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+    		put(e_index, *ei, edge_count++);
+  
+  	embedding_storage.clear(); 
+	embedding_storage.resize(num_vertices(g));
+
+	bool is_planar = 0;
+
+  	if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::embedding = &embedding_storage[0]) )
+	{
+ //   	   std::cout << "Input graph is planar" << std::endl;
+
+	   is_planar = 1;
+
+	   // input must be connected planar graph
+	   my_add_edge_visitor<planarGraph, Vertex> e_vis;
+
+	   make_connected(g, get(vertex_index, g), e_vis);
+
+ 	   make_biconnected_planar(g, &embedding_storage[0], get(edge_index, g), e_vis);
+
+// following drawn from printing code below
+        }
+  	   if (!boyer_myrvold_planarity_test(g))
+	   	is_planar = 0;
+
+  //	   for ( int i = 0; i < e_vis.e_vis.size(); i++ )
+//  	   {
+//              std::cout << e_vis.e_vis[i].first << " "
+//                  	<< e_vis.e_vis[i].second
+//                  	<< std::endl;
+//  	   }
+
+ // 	   if (boyer_myrvold_planarity_test(g))
+//    	      std::cout << "Also, the graph is still planar." << std::endl;
+//  	   else
+//    	      std::cout << "But the graph is not still planar." << std::endl;
+//	}
+//  	else
+//	{
+//    	   std::cout << "Input graph is not planar" << std::endl;
+//
+//	   is_planar = 0;
+//	}
+  
+	// output is a graph
+        SEXP ans, b_vec, ansList;
+
+        PROTECT(ansList = allocVector(VECSXP,2));
+
+        PROTECT(ans = NEW_INTEGER(1));
+        INTEGER(ans)[0] = is_planar;
+        SET_VECTOR_ELT(ansList,0,ans);
+
+	PROTECT(b_vec = allocMatrix(INTSXP, 2, num_edges(g)));
+
+	int i;
+  	for( i = 0, tie(ei, ei_end) = edges(g); ei != ei_end; ++ei )
+	{
+	   INTEGER(b_vec)[i++] = source(*ei, g);
+	   INTEGER(b_vec)[i++] = target(*ei, g);
+	}
+
+        SET_VECTOR_ELT(ansList,1,b_vec);
+
+	UNPROTECT(3);
+	return ansList;
+     }
+
+     SEXP makeMaximalPlanar(SEXP num_verts_in,
+                        SEXP num_edges_in, SEXP R_edges_in )
+     {
+	planarGraph g;
+	initPlanarGraph(&g, num_verts_in, num_edges_in, R_edges_in);
+
+  	//Initialize the interior edge index
+	e_index = get(edge_index, g);
+  	edge_count = 0;
+  	for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+    		put(e_index, *ei, edge_count++);
+  
+	bool is_planar = 0;
+
+  	embedding_storage.clear(); 
+	embedding_storage.resize(num_vertices(g));
+  	if ( boyer_myrvold_planarity_test(
+		   boyer_myrvold_params::graph = g,
+                   boyer_myrvold_params::embedding = &embedding_storage[0]) )
+	{
+//    	   std::cout << "Input graph is planar" << std::endl;
+	   is_planar = 1;
+
+  	   // input to make_maximal_planar must be biconnected
+	   my_add_edge_visitor<planarGraph, Vertex> e1_vis;
+
+	   make_connected(g, get(vertex_index, g), e1_vis);
+
+  	   make_biconnected_planar(g, &embedding_storage[0], 
+			get(edge_index, g), e1_vis);
+
+  	   // Re-initialize the edge index, since we just added a few edges
+  	   edge_count = 0;
+  	   for(tie(ei, ei_end) = edges(g); ei != ei_end; ++ei)
+    	   	put(e_index, *ei, edge_count++);
+
+  	   embedding_storage.clear(); 
+	   embedding_storage.resize(num_vertices(g));
+  	   if ( boyer_myrvold_planarity_test(boyer_myrvold_params::graph = g,
+                           boyer_myrvold_params::embedding = &embedding_storage[0]))
+	   {
+ //   	      std::cout << "After calling make_biconnected, the graph is still planar" 
+//              		<< std::endl;
+	   }
+  	   else
+	   {
+	      // should NOT be here
+//    	      std::cout << "After calling make_biconnected, the graph is not planar" 
+//              		<< std::endl;
+	   }
+
+  	   // input must be biconnected w/ 3+ nodes
+	   my_add_edge_visitor<planarGraph, Vertex> e_vis;
+  	   make_maximal_planar(g, &embedding_storage[0], 
+			get(vertex_index, g), get(edge_index, g), e_vis);
+
+	}
+  	else
+	{
+ //   	   std::cout << "Input graph is not planar" << std::endl;
+	   is_planar = 0;
+	}
+  
+	// output is a graph
+        SEXP ans, b_vec, ansList;
+
+        PROTECT(ansList = allocVector(VECSXP,2));
+
+        PROTECT(ans = NEW_INTEGER(1));
+        INTEGER(ans)[0] = is_planar;
+        SET_VECTOR_ELT(ansList,0,ans);
+
+        PROTECT(b_vec = allocMatrix(INTSXP, 2, num_edges(g)));
+
+        int i;
+        for( i = 0, tie(ei, ei_end) = edges(g); ei != ei_end; ++ei )
+        {
+           INTEGER(b_vec)[i++] = source(*ei, g);
+           INTEGER(b_vec)[i++] = target(*ei, g);
+        }
+
+        SET_VECTOR_ELT(ansList,1,b_vec);
+
+        UNPROTECT(3);
+        return ansList; 
+
+     }
+
+    SEXP edmondsMaxCardinalityMatching(SEXP num_verts_in, 
+				SEXP num_edges_in,SEXP R_edges_in)
+    {
+	typedef graph_traits<Graph_ui>::vertex_descriptor Vertex;
+
+	Graph_ui g(num_verts_in, num_edges_in, R_edges_in);
+
+	graph_traits<Graph_ui>::vertex_iterator vi, vi_end;
+
+	std::vector<Vertex> mate(num_vertices(g));
+
+	bool is_max = checked_edmonds_maximum_cardinality_matching(g, &mate[0]);
+
+	SEXP ans, b_vec, ansList;
+
+	PROTECT(ansList = allocVector(VECSXP,2));
+
+        PROTECT(ans = NEW_INTEGER(1));
+        INTEGER(ans)[0] = is_max;
+        SET_VECTOR_ELT(ansList,0,ans);
+
+        int m_cnt;
+        for( m_cnt = 0, tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi )
+        {
+	   if ( mate[*vi] != graph_traits< Graph_ui >::null_vertex() &&
+		*vi < mate[*vi] )
+	   m_cnt++;
+	}
+
+        PROTECT(b_vec = allocMatrix(INTSXP, 2, m_cnt));
+
+	int i;
+        for( i = 0, tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi )
+        {
+	   if ( mate[*vi] != graph_traits< Graph_ui >::null_vertex() &&
+		*vi < mate[*vi] )
+	   {
+           	INTEGER(b_vec)[i++] = *vi;
+           	INTEGER(b_vec)[i++] = mate[*vi];
+	   }
+        }
+
+        SET_VECTOR_ELT(ansList,1,b_vec);
+
+	UNPROTECT(3);
+	return ansList;
+
+    }
+}
+
diff --git a/src/shortestPath.cpp b/src/shortestPath.cpp
new file mode 100644
index 0000000..3273c05
--- /dev/null
+++ b/src/shortestPath.cpp
@@ -0,0 +1,200 @@
+#include "RBGL.hpp"
+#include "Basic2DMatrix.hpp"
+#include <boost/graph/dijkstra_shortest_paths.hpp>
+#include <boost/graph/johnson_all_pairs_shortest.hpp>
+#include <boost/graph/dag_shortest_paths.hpp>
+#include <boost/graph/bellman_ford_shortest_paths.hpp>
+#include <boost/graph/floyd_warshall_shortest.hpp>
+
+extern "C"
+{
+    SEXP BGL_dijkstra_shortest_paths_D (SEXP num_verts_in,
+                                        SEXP num_edges_in, SEXP R_edges_in,
+                                        SEXP R_weights_in, SEXP init_ind)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        int N = num_vertices(g);
+        std::vector<Vertex> p(N);
+        std::vector<double> d(N);
+
+        dijkstra_shortest_paths(g, vertex((int)INTEGER(init_ind)[0], g),
+                                predecessor_map(&p[0]).distance_map(&d[0]));
+
+        SEXP dists, pens, ansList;
+        PROTECT(dists = allocVector(REALSXP,N));
+        PROTECT(pens = allocVector(INTSXP,N));
+        graph_traits < Graph_dd >::vertex_iterator vi, vend;
+        for (tie(vi, vend) = vertices(g); vi != vend; ++vi) {
+            REAL(dists)[*vi] = d[*vi];
+            INTEGER(pens)[*vi] = p[*vi];
+        }
+        PROTECT(ansList = allocVector(VECSXP,2));
+        SET_VECTOR_ELT(ansList,0,dists);
+        SET_VECTOR_ELT(ansList,1,pens);
+
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+    SEXP BGL_johnson_all_pairs_shortest_paths_D(SEXP num_verts_in,
+            SEXP num_edges_in, SEXP R_edges_in,
+            SEXP R_weights_in)
+    {
+        using namespace boost;
+        int nv = INTEGER(num_verts_in)[0];
+        SEXP out;
+
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        Basic2DMatrix<double> D(nv, nv);
+
+        johnson_all_pairs_shortest_paths(g, D);
+
+        PROTECT(out = NEW_NUMERIC(nv*nv));
+        int k = 0;
+        for (int i = 0 ; i < nv ; i++)
+            for (int j = 0; j < nv; j++ )
+            {
+                REAL(out)[k] = D[i][j];
+                k++;
+            }
+        UNPROTECT(1);
+        return out;
+    }
+
+    SEXP BGL_bellman_ford_shortest_paths(SEXP num_verts_in,
+                                         SEXP num_edges_in, SEXP R_edges_in,
+                                         SEXP R_weights_in, SEXP init_ind)
+    {
+        using namespace boost;
+
+        typedef adjacency_list < vecS, vecS, directedS,
+        no_property, property < edge_weight_t, double> > EdgeGraph;
+
+        int i;
+        int NE = (int)INTEGER(num_edges_in)[0];
+        int N = (int)INTEGER(num_verts_in)[0];
+        int s = (int)INTEGER(init_ind)[0];
+
+        EdgeGraph g(N);
+
+        int* edges_in = INTEGER(R_edges_in);
+        for ( i = 0; i < NE; i++, edges_in += 2 )
+            add_edge(*edges_in, *(edges_in+1), g);
+
+        std::vector<std::size_t> p(N);
+        for ( i = 0; i < N; i++ ) p[i] = i;
+
+        std::vector<double> d(N, std::numeric_limits<double>::max());
+        d[s] = 0;
+
+        property_map<EdgeGraph, edge_weight_t>::type w = get(edge_weight, g);
+
+        int* weight_i = (isReal(R_weights_in)) ? 0 : INTEGER(R_weights_in);
+        double* weight_d = (isReal(R_weights_in)) ? REAL(R_weights_in) : 0;
+
+        graph_traits< EdgeGraph >::edge_iterator ei, ei_end;
+        for ( tie(ei, ei_end) = edges(g); ei != ei_end; ++ei )
+            w[*ei] = weight_i ? (*weight_i++) : (*weight_d++);
+
+        bool r = bellman_ford_shortest_paths(g, N,
+                 weight_map(w).predecessor_map(&p[0]).distance_map(&d[0]));
+
+        SEXP conn, dList, pList, ansList;
+        PROTECT(ansList = allocVector(VECSXP,3));
+        PROTECT(conn = NEW_LOGICAL(1));
+        PROTECT(dList = allocVector(REALSXP,N));
+        PROTECT(pList = allocVector(INTSXP,N));
+
+        LOGICAL(conn)[0] = r;
+
+        for (i = 0; i < N; i++)
+        {
+            INTEGER(pList)[i] = p[i];
+            REAL(dList)[i] = d[i];
+        }
+
+        SET_VECTOR_ELT(ansList,0,conn);
+        SET_VECTOR_ELT(ansList,1,dList);
+        SET_VECTOR_ELT(ansList,2,pList);
+
+        UNPROTECT(4);
+        return(ansList);
+    }
+
+    SEXP BGL_dag_shortest_paths(SEXP num_verts_in,
+                                SEXP num_edges_in, SEXP R_edges_in,
+                                SEXP R_weights_in, SEXP init_ind)
+    {
+        using namespace boost;
+
+        typedef graph_traits < Graph_dd >::edge_descriptor Edge;
+        typedef graph_traits < Graph_dd >::vertex_descriptor Vertex;
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        int N = num_vertices(g);
+        std::vector<Vertex> p(N);
+        std::vector<double> d(N);
+
+        dag_shortest_paths(g, vertex((int)INTEGER(init_ind)[0], g),
+                           predecessor_map(&p[0]).distance_map(&d[0]));
+
+        SEXP dists, pens, ansList;
+        PROTECT(dists = allocVector(REALSXP,N));
+        PROTECT(pens = allocVector(INTSXP,N));
+        graph_traits < Graph_dd >::vertex_iterator vi, vend;
+        for (tie(vi, vend) = vertices(g); vi != vend; ++vi) {
+            if ( int(d[*vi]) == std::numeric_limits<int>::max() )
+            {
+                REAL(dists)[*vi] = R_NaN;
+                INTEGER(pens)[*vi] = *vi;
+            }
+            else
+            {
+                REAL(dists)[*vi] = d[*vi];
+                INTEGER(pens)[*vi] = p[*vi];
+            }
+        }
+        PROTECT(ansList = allocVector(VECSXP,2));
+        SET_VECTOR_ELT(ansList,0,dists);
+        SET_VECTOR_ELT(ansList,1,pens);
+
+        UNPROTECT(3);
+        return(ansList);
+    }
+
+    SEXP BGL_floyd_warshall_all_pairs_shortest_paths_D(SEXP num_verts_in,
+            SEXP num_edges_in, SEXP R_edges_in,
+            SEXP R_weights_in)
+    {
+        using namespace boost;
+        typedef adjacency_list<vecS, vecS, directedS, no_property,
+        property< edge_weight_t, double, property< edge_weight2_t, double > > > Graph;
+        int nv = INTEGER(num_verts_in)[0];
+        SEXP out;
+        typedef std::pair < int, int >Edge;
+
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        Basic2DMatrix<double> D(nv, nv);
+
+        floyd_warshall_all_pairs_shortest_paths(g, D);
+
+        PROTECT(out = NEW_NUMERIC(nv*nv));
+        int k = 0;
+        for (int i = 0 ; i < nv ; i++)
+            for (int j = 0; j < nv; j++ )
+            {
+                REAL(out)[k] = D[i][j];
+                k++;
+            }
+        UNPROTECT(1);
+        return out;
+    }
+}
+
diff --git a/src/sna.cpp b/src/sna.cpp
new file mode 100644
index 0000000..9313680
--- /dev/null
+++ b/src/sna.cpp
@@ -0,0 +1,255 @@
+#include "RBGL.hpp"
+#include "Basic2DMatrix.hpp"
+#include <boost/graph/johnson_all_pairs_shortest.hpp>
+#include <boost/graph/edmonds_karp_max_flow.hpp>
+
+extern "C"
+{
+
+#include <Rdefines.h>
+
+    using namespace std;
+    using namespace boost;
+
+    typedef std::set<int> SubgraphAsSet;
+    typedef std::vector< SubgraphAsSet > CliqueVector;
+    typedef std::vector< CliqueVector > ResultCliquesType;
+
+    static void addNewClique(CliqueVector& cliques, int i, int j)
+    {
+        SubgraphAsSet s;
+        s.insert(i);
+        s.insert(j);
+        cliques.push_back(s);
+    }
+
+    static void findAllCliques(ResultCliquesType& rCliques,
+                               Basic2DMatrix<double>& D)
+    {
+        CliqueVector cliques;
+        SubgraphAsSet::iterator s;
+        CliqueVector::iterator ci, cj;
+        int i, j, k, N=0;
+        const int nv = D.numrows();
+
+        // N: max distance in given graph
+        for ( i = 0; i < nv; i++ )
+            for ( j = i+1; j < nv; j++ )
+            {
+                N = max(N, (int)D[i][j]);
+                // each edge is 1-clique
+                if ( D[i][j] == 1 ) addNewClique(cliques, i, j);
+            }
+
+        for ( k = 1; k <= N; k++ )
+        {
+            for ( i = 0; i < nv; i++ )
+            {
+                for ( ci = cliques.begin(); ci != cliques.end(); ci++ )
+                {
+                    // i is already in this clique
+                    if ( (*ci).find(i) != (*ci).end() ) continue;
+
+                    for ( s = (*ci).begin(); s != (*ci).end(); s++ )
+                    {
+                        if ( D[i][*s] > k || D[*s][i] > k ) break;
+                    }
+
+                    // add i to this clique
+                    if ( s == (*ci).end() )
+                    {
+                        (*ci).insert(i);
+
+                        // eliminate its subsequent subsets
+                        for ( cj = ci + 1; cj != cliques.end(); )
+                        {
+                            if (includes((*ci).begin(), (*ci).end(),
+                                         (*cj).begin(), (*cj).end()) )
+                                cj = cliques.erase(cj);
+                            else
+                                cj++;
+                        }
+                    }
+                }
+            }
+            rCliques.push_back(cliques);
+        }
+
+#if DEBUG
+        cout << " Cliques: " << endl;
+        for ( i = 0; i < rCliques.size(); i++ )
+        {
+            cout << i+1 << " cliques: " << endl;
+            for ( ci=rCliques[i].begin(); ci!=rCliques[i].end(); ci++ )
+            {
+                cout << "    ";
+                for ( s = (*ci).begin(); s != (*ci).end(); s++ )
+                    cout << (*s)+1 << " ";
+                cout << endl;
+            }
+        }
+#endif
+    }
+
+    SEXP kCliques(SEXP num_verts_in, SEXP num_edges_in,
+                  SEXP R_edges_in, SEXP R_weights_in)
+    {
+        // R_weights_in has to be INTEGER now
+        int nv = INTEGER(num_verts_in)[0];
+
+        Graph_ud g(num_verts_in, num_edges_in, R_edges_in, R_weights_in);
+
+        Basic2DMatrix<double> D(nv, nv);
+
+        // find out the shortest distance between any two nodes
+        johnson_all_pairs_shortest_paths(g, D);
+
+        // find k-cliques now
+        ResultCliquesType rCliques;
+        findAllCliques(rCliques, D);
+
+        ResultCliquesType::iterator ci;
+        CliqueVector::iterator vi;
+        SubgraphAsSet::iterator si;
+        int i, j, k;
+
+        SEXP ansList, cList, sList;
+        PROTECT(ansList = allocVector(VECSXP, (int)rCliques.size()));
+
+        for ( i = 0, ci = rCliques.begin(); ci != rCliques.end(); i++, ci++)
+        {
+            PROTECT(cList = allocVector(VECSXP, (*ci).size()));
+            for ( j = 0, vi = (*ci).begin(); vi != (*ci).end(); j++, vi++ )
+            {
+                PROTECT(sList = allocVector(INTSXP, (*vi).size()));
+                for ( k = 0, si = (*vi).begin(); si != (*vi).end(); k++, si++ )
+                {
+                    INTEGER(sList)[k] = *si;
+                }
+                SET_VECTOR_ELT(cList,j,sList);
+                UNPROTECT(1);
+            }
+            SET_VECTOR_ELT(ansList,i,cList);
+            UNPROTECT(1);
+        }
+        UNPROTECT(1);
+        return(ansList);
+    }
+
+    SEXP lambdaSets(SEXP num_verts_in, SEXP num_edges_in,
+                    SEXP R_edges_in, SEXP R_capacity_in)
+    {
+        using namespace boost;
+
+        typedef adjacency_list_traits<vecS, vecS, directedS> Tr;
+        typedef Tr::edge_descriptor Tr_edge_desc;
+
+        typedef adjacency_list<vecS, vecS, directedS, no_property,
+        property<edge_capacity_t, double,
+        property<edge_residual_capacity_t, double,
+        property<edge_reverse_t, Tr_edge_desc> > > >
+        FlowGraph;
+
+        typedef graph_traits<FlowGraph>::vertex_descriptor vertex_descriptor;
+	typedef graph_traits<FlowGraph>::edge_descriptor edge_descriptor;
+
+        FlowGraph flow_g;
+
+        property_map < FlowGraph, edge_capacity_t >::type
+        cap = get(edge_capacity, flow_g);
+        property_map < FlowGraph, edge_residual_capacity_t >::type
+        res_cap = get(edge_residual_capacity, flow_g);
+        property_map < FlowGraph, edge_reverse_t >::type
+        rev_edge = get(edge_reverse, flow_g);
+
+        edge_descriptor e1, e2;
+        bool in1, in2;
+
+        if (!isInteger(R_edges_in)) error("R_edges_in should be integer");
+
+        int NV = INTEGER(num_verts_in)[0];
+        int NE = asInteger(num_edges_in);
+        int* edges_in = INTEGER(R_edges_in);
+	int i, j, k, MaxC=0; 
+
+        for (i = 0; i < NE ; i++, edges_in += 2)
+        {
+            tie(e1, in1) = boost::add_edge(*edges_in, *(edges_in+1), flow_g);
+            tie(e2, in2) = boost::add_edge(*(edges_in+1), *edges_in, flow_g);
+            if ( !in1 || !in2 )
+                error("unable to add edge: (%d, %d)", *edges_in, *(edges_in+1));
+
+            // fill in capacity_map
+            cap[e1] = 1; 
+            cap[e2] = 1; 
+
+            // fill in reverse_edge_map
+            rev_edge[e1] = e2;
+            rev_edge[e2] = e1;
+        }
+
+        // ASSUMPTION: max_flow(u, v) = max_flow(v, u)
+        // compute edge connectivities between u and v, (u < v)
+	// we only need lower-left triangle of the matrix w/o diagonal
+        Basic2DMatrix<int> CC(NV, NV);
+
+        for ( i = 0; i < NV; i++ )
+        {
+            vertex_descriptor s = vertex(i, flow_g);
+
+            for ( j = 0; j < i; j++ )
+            {
+                vertex_descriptor t = vertex(j, flow_g);
+
+                CC[i][j] = (int)edmonds_karp_max_flow(flow_g, s, t);
+                MaxC = max(MaxC, CC[i][j]);
+            }
+        }
+
+        // calc lambda sets by successively partition V
+        Basic2DMatrix<int> P(MaxC+1, NV);
+        for ( k = 0; k <= MaxC; k++ )
+        {
+            for ( i = 0; i < NV; i++ ) P[k][i] = i;
+
+            for ( i = 1; i < NV; i++ )
+                for ( j = 0; j < i; j++ )
+                    if ( CC[i][j] >= k )  P[k][i] = P[k][j];
+        }
+
+#if DEBUG
+        cout << " edge-connectivity matrix: " << endl;
+        for ( i = 0; i < NV; i++ )
+        {
+            for ( j = 0; j < NV; j++ ) cout << CC[i][j] << " ";
+            cout << endl;
+        }
+
+        cout << " P matrix: " << endl;
+        for ( k = 0; k <= MaxC; k++ )
+        {
+            cout << " k = " << k << ": ";
+            for ( j = 0; j < NV; j++ ) cout << P[k][j] << " ";
+            cout << endl;
+        }
+#endif
+
+        SEXP ansList, conn, eList;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(conn = NEW_NUMERIC(1));
+        PROTECT(eList = allocMatrix(INTSXP, MaxC+1, NV));
+
+        REAL(conn)[0] = MaxC;
+
+        for ( i = 0, j = 0; j < NV; j++ )
+            for ( k = 0; k <= MaxC; k++ )
+                INTEGER(eList)[i++] = P[k][j];
+
+        SET_VECTOR_ELT(ansList,0,conn);
+        SET_VECTOR_ELT(ansList,1,eList);
+        UNPROTECT(3);
+
+        return(ansList);
+    }
+}
+
diff --git a/src/transitive_closure.cpp b/src/transitive_closure.cpp
new file mode 100644
index 0000000..f6a4066
--- /dev/null
+++ b/src/transitive_closure.cpp
@@ -0,0 +1,58 @@
+// NOTE:   May 31, 2006
+// gcc 4.1 has problem handling this function as it was part of interfaces.cpp;
+// initial investigation points to some interplay among the header files;
+// the current include-order works, while the following order generates lots
+// of errors in compiling:
+//       #include "RBGL.hpp"
+//       #include <boost/graph/transitive_closure.hpp>
+//       #include <boost/graph/graphviz.hpp>
+// It's a work-around to separate this function from the rest and include header
+// files differently.
+// NOTE:   Jun 1, 2006
+// The problem seems in 
+//       #include <boost/graph/graphviz.hpp>
+// since we don't need it, we remove it from RBGL.hpp, everything seems ok.
+
+#include <boost/graph/transitive_closure.hpp>
+#include "RBGL.hpp"
+
+extern "C"
+{
+    SEXP BGL_transitive_closure_D (SEXP num_verts_in, 
+    		SEXP num_edges_in, SEXP R_edges_in )
+    {
+    	using namespace boost;
+    	
+        Graph_dd g(num_verts_in, num_edges_in, R_edges_in );
+        Graph_dd TC;
+    	
+    	transitive_closure(g, TC);
+
+        SEXP ansList, eList, vList;
+        PROTECT(ansList = allocVector(VECSXP,2));
+        PROTECT(vList = allocMatrix(INTSXP, 1, num_vertices(TC)));
+        PROTECT(eList = allocMatrix(INTSXP, 2, num_edges(TC)));
+
+        Graph_dd::vertex_iterator vi, v_end;
+        int i = 0;
+        for (i = 0, tie(vi, v_end) = vertices(TC); vi != v_end; ++vi)
+	{
+		INTEGER(vList)[i++] = *vi;
+	}
+
+        Graph_dd::edge_iterator ei, e_end;
+        for (i = 0, tie(ei, e_end) = edges(TC); ei != e_end; ++ei)
+        {
+            INTEGER(eList)[i++] = source(*ei, TC);
+            INTEGER(eList)[i++] = target(*ei, TC);
+        }
+    
+        SET_VECTOR_ELT(ansList,0,vList);
+        SET_VECTOR_ELT(ansList,1,eList);
+        UNPROTECT(3);
+        return(ansList);
+
+    }
+
+}
+
diff --git a/src/wavefront.cpp b/src/wavefront.cpp
new file mode 100644
index 0000000..25a4c97
--- /dev/null
+++ b/src/wavefront.cpp
@@ -0,0 +1,115 @@
+#include "RBGL.hpp"
+#include <boost/graph/bandwidth.hpp>
+#include <boost/graph/profile.hpp>
+#include <boost/graph/wavefront.hpp>
+
+extern "C"
+{
+
+	SEXP BGL_bandwidth(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in )
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_INTEGER(1));
+
+		INTEGER(rbw)[0] = bandwidth(g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_profile(SEXP num_verts_in, SEXP num_edges_in, SEXP R_edges_in )
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_INTEGER(1));
+
+		INTEGER(rbw)[0] = profile(g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_ith_wavefront(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in,   SEXP init_ind)
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_INTEGER(1));
+
+		INTEGER(rbw)[0] = ith_wavefront(vertex((int)INTEGER(init_ind)[0], g), g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_max_wavefront(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in)
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_INTEGER(1));
+
+		INTEGER(rbw)[0] = max_wavefront(g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_aver_wavefront(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in)
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_NUMERIC(1));
+
+		REAL(rbw)[0] = aver_wavefront(g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+
+	SEXP BGL_rms_wavefront(SEXP num_verts_in, SEXP num_edges_in,
+                         SEXP R_edges_in)
+	{
+		using namespace boost;
+
+		Graph_ud g(num_verts_in, num_edges_in, R_edges_in);
+
+		SEXP ansList, rbw;
+		PROTECT(ansList = allocVector(VECSXP,1));
+		PROTECT(rbw = NEW_NUMERIC(1));
+
+		REAL(rbw)[0] = rms_wavefront(g);
+
+		SET_VECTOR_ELT(ansList,0,rbw);
+		UNPROTECT(2);
+		return(ansList);
+	}
+}
+
diff --git a/tests/runTests.R b/tests/runTests.R
new file mode 100644
index 0000000..61e9123
--- /dev/null
+++ b/tests/runTests.R
@@ -0,0 +1 @@
+BiocGenerics:::testPackage("RBGL")
\ No newline at end of file
diff --git a/vignettes/RBGL.Rnw b/vignettes/RBGL.Rnw
new file mode 100644
index 0000000..7b60a8d
--- /dev/null
+++ b/vignettes/RBGL.Rnw
@@ -0,0 +1,1197 @@
+%
+% NOTE -- ONLY EDIT RBGL.Rnw!!!
+% RBGL.tex file will get overwritten.
+%
+%\VignetteIndexEntry{RBGL Overview}
+%\VignetteDepends{graph}
+%\VignetteKeywords{Graphs}
+%\VignettePackage{RBGL}
+
+\documentclass[12pt]{article}
+
+\usepackage{amsmath}
+\usepackage[authoryear,round]{natbib}
+\usepackage{hyperref}
+
+
+\textwidth=6.2in
+\textheight=8.5in
+%\parskip=.3cm
+\oddsidemargin=.1in
+\evensidemargin=.1in
+\headheight=-.3in
+
+\newcommand{\scscst}{\scriptscriptstyle}
+\newcommand{\scst}{\scriptstyle}
+
+\newcommand\Rpackage[1]{{\textsf{#1}\index{#1 (package)}}}
+\newcommand\RpackageNoindex[1]{{\textsf{#1}}}
+\newcommand\Rclass[1]{{\textit{#1}\index{#1 (class)}}}
+\newcommand\Rfunction[1]{{{\small\texttt{#1}}\index{#1 (function)}}}
+\newcommand\Rmethod[1]{{\small\texttt{#1}}}
+\newcommand\Rcommand[1]{{{\small\texttt{#1}}\index{#1 (function)}}}
+\newcommand\Rfunarg[1]{{\small\texttt{#1}}}
+\newcommand\Robject[1]{{\small\texttt{#1}}}
+
+
+%\setkeys{Gin}{width=0.55\textwidth}
+
+
+\bibliographystyle{plainnat}
+
+\begin{document}
+
+<<echo=false, results=hide>>=
+library(RBGL)
+library(Rgraphviz)
+library(XML)
+@
+
+\title{{\it RBGL}: R interface to boost graph library}
+\author{L. Long, VJ Carey, and R. Gentleman}
+\maketitle
+
+\begin{quotation} {\it Summary}.
+The \Rpackage{RBGL} package is primarily
+an interface from R to the Boost Graph Library (BGL).
+It includes some graph algorithms built on top of those from BGL and
+some algorithms independent of BGL.
+\end{quotation}
+
+\tableofcontents
+
+\section{Basic notations/Preliminaries}
+
+\subsection{Basics Notations}
+
+We use the following notation:
+
+{\em G}: a graph, represented as G = (V, E);
+{\em V} = {v1, v2, ..., vn}: a set of vertices (or nodes);
+{\em E} = {e1, e2, ..., em}: a set of edges with ei = [vj, vk], with vj, vk are in V;
+{\em W} = {w1, w2, ..., wm}: a set of weights of the edges, i.e., wi is the weight on edge ei.
+
+A {\em walk} is a sequence of vertices {v1, v2, ..., vk} such that for all i, [vi, vi+1] in {\em E}.
+A {\em path} is a walk without repeated vertices.
+A {\em cycle} is a path that begins and ends at the same vertice.
+
+A {\em directed} graph is a graph with direction assigned to its edges, therefore, [vj, vk] != [vk, vj].
+
+A {\em directed acyclic graph (DAG)} is a directed graph with no directed cycle.
+
+An {\em in-degree} of vertex v is the total number of edges [u, v] in E; an {\em out-degree} of v is the total number of edges [v, u] in {\em E}.
+
+A network {\em N} is a directed graph {\em G} with (a) a source {\em s} whose in-degree is 0,
+(b) a sink {\em t} whose out-degree is 0, and
+(c) a {\em capacity} for each edge in a network.
+
+A {\em flow} in {\em N} assigns a value on each edge that doesn't exceed its capacity,
+all the internal vertices have the same incoming flow as the outgoing flow,
+{\em s} has outgoing flow only, {\em t} has incoming flow only.
+
+
+\subsection{Examples in use}
+We are going to use the following graphs repeatedly in the examples.
+
+<<bfDemo>>=
+con <- file(system.file("XML/bfsex.gxl", package="RBGL"))
+bf <- fromGXL(con)
+close(con)
+@
+
+<<figbf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(bf, main="a) Breath-First Search Example")
+@
+
+<<dfDemo>>=
+con <- file(system.file("XML/dfsex.gxl", package="RBGL"))
+df <- fromGXL(con)
+close(con)
+@
+
+<<figdf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(df, main="b) Depth-First Search Example")
+@
+
+<<dijkstraDemo>>=
+con <- file(system.file("XML/dijkex.gxl", package="RBGL"))
+dijk <- fromGXL(con)
+close(con)
+@
+
+<<figdijk, fig=TRUE, echo=FALSE, results=hide, include=FALSE>>=
+ plot(dijk, main="c) Dijkstra's Example")
+@
+
+<<connDemo>>=
+con <- file(system.file("XML/conn.gxl", package="RBGL"))
+coex <- fromGXL(con)
+close(con)
+@
+
+<<figcoex, fig=TRUE, echo=FALSE, results=hide, include=FALSE>>=
+ plot(coex, main="d) Coex Example")
+@
+
+<<conn2Demo>>=
+con <- file(system.file("XML/conn2.gxl", package="RBGL"))
+coex2 <- fromGXL(con)
+close(con)
+@
+
+<<figcoex2, fig=TRUE, echo=FALSE, results=hide, include=FALSE >>=
+  plot(coex2, main="e) Coex2 Example")
+@
+
+<<conn2iDemo>>=
+con <- file(system.file("XML/conn2iso.gxl", package="RBGL"))
+coex2i <- fromGXL(con)
+close(con)
+@
+
+<<figcoex2i, fig=TRUE, echo=FALSE, results=hide, include=FALSE >>=
+  plot(coex2i, main="f) Coex2 Isomorphism Example")
+@
+
+<<kmstDemo>>=
+con <- file(system.file("XML/kmstEx.gxl", package="RBGL"))
+km <- fromGXL(con)
+close(con)
+@
+
+<<figkmst, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(km, main="g) Kruskal MST Example")
+@
+
+<<bicoDemo>>=
+con <- file(system.file("XML/biconn.gxl", package="RBGL"))
+bicoex <- fromGXL(con)
+close(con)
+@
+
+<<figbico, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(bicoex, main="h) Biconnected Component Example")
+@
+
+<<ospfDemo>>=
+con <- file(system.file("XML/ospf.gxl", package="RBGL"))
+ospf <- fromGXL(con)
+close(con)
+@
+
+<<figospf, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(ospf, main="i) Ospf Example")
+@
+
+<<zzDemo>>=
+con <- file(system.file("dot/joh.gxl", package="RBGL"))
+joh <- fromGXL(con)
+close(con)
+@
+
+<<figjoh, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(joh, main="j) joh Example")
+@
+
+<<hcsDemo>>=
+con <- file(system.file("XML/hcs.gxl", package="RBGL"))
+hcs <- fromGXL(con)
+close(con)
+@
+
+<<fighcs, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(hcs, main="k) HCS Example")
+@
+
+<<kclexDemo>>=
+con <- file(system.file("XML/snacliqueex.gxl", package="RBGL"))
+kclex <- fromGXL(con)
+close(con)
+@
+
+<<figkclex, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(kclex, main="l) kCliques Example")
+@
+
+<<kcoexDemo>>=
+con <- file(system.file("XML/snacoreex.gxl", package="RBGL"))
+kcoex <- fromGXL(con)
+close(con)
+@
+
+<<figkcoex, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+  plot(kcoex, main="m) kCores Example")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figbf} &
+\includegraphics[width=0.49\textwidth]{RBGL-figdf} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figdijk} &
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (I). }
+\end{figure}
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex2} &
+\includegraphics[width=0.49\textwidth]{RBGL-figcoex2i} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figkmst} &
+\includegraphics[width=0.49\textwidth]{RBGL-figbico} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (II). }
+\end{figure}
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-fighcs} &
+\includegraphics[width=0.49\textwidth]{RBGL-figkclex} \\
+\includegraphics[width=0.49\textwidth]{RBGL-figkcoex} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+The example graphs (III). }
+\end{figure}
+
+\section{Working with the Bioconductor {\tt graph} class}
+An example object representing file dependencies is included, as shown
+in Figure \ref{fdpic}.
+
+<<showFileDep>>=
+data(FileDep)
+FileDep
+@
+\begin{figure}
+<<figfd, fig=TRUE, echo=false>>=
+z <- plot(FileDep)
+@
+%\includegraphics{filedep}
+\caption{File dependency digraph example from Boost library.}
+\label{fdpic}
+\end{figure}
+
+\section{Algorithms from BGL}
+
+\subsection{Depth First Search}
+
+The \Rfunction{dfs} function returns two vectors of node names of 
+discovery and finish order in a depth-first-search (DFS), starting at the 
+given vertex.
+
+<<DFSdemo>>=
+print(dfs.res <- dfs(df, "y"))
+@
+
+In this example, DFS starts with {\em y}, reaches {\em x} and {\em v}; 
+DFS restarts from {\em w}, reaches {\em z}; 
+DFS restarts from {\em u}; at this point, all the vertices in the graph are
+visited once and only once.  You could see the search order in the figure.
+
+<<figdfs1, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+plot(df, main="a) DFS Example")
+@
+
+<<figdfs2, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+dfsNattrs <- makeNodeAttrs(df)
+dfsNattrs$label[dfs.res$discovered] <- 1:numNodes(df)
+plot(df, nodeAttrs=dfsNattrs, main="b) DFS Example with search order")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figdfs1}&
+\includegraphics[width=0.49\textwidth]{RBGL-figdfs2} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:dfsex}%
+a) The graph for depth-first-search example.
+b) The graph for depth-first-search example, showing search orders.}
+\end{figure}
+
+\subsection{Breadth First Search}
+
+The \Rfunction{bfs} function returns a vector of node names of discovery order
+in a breadth-first search (BFS), starting at the given vertex. 
+
+<<BFSdemo>>=
+print(bfs.res <- bfs(bf,"s"))
+@
+
+In this example, BFS starts from vertex {\em s}, reaches {\em w}; 
+from {\em w} BFS reaches {\em r}, {\em t} and {\em x}; 
+from {\em r} BFS reaches {\em v}; 
+from {\em t} BFS reaches {\em u}; 
+from {\em x} BFS reaches {\em y};
+at this time, BFS visits all the vertices in the graph once and only once.
+ 
+<<figbfs1, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+plot(bf, main="a) BFS Example")
+@
+
+<<figbfs2, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+bfsNattrs <- makeNodeAttrs(bf)
+bfsNattrs$label[bfs.res] <- 1:numNodes(bf)
+plot(bf, nodeAttrs=bfsNattrs, main="b) BFS Example with search order")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figbfs1}&
+\includegraphics[width=0.49\textwidth]{RBGL-figbfs2} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:bfsex}%
+a) The graph for breadth-first-search example.
+b) The graph for breadth-first-search example, showing search orders.}
+\end{figure}
+
+\subsection{Shortest paths}
+
+Edge weights play a major role in shortest-path problems.
+The weight of an edge in a graph could represent the relationship between the
+two vertices, such as distance, probability, etc.  
+
+TO-BE-FINALIZED:
+Our knowledge of such a relationship between two vertices is:
+(1) we know there is an edge and there is a measured value on it;
+(2) we know there is an edge but there is NO measured value on it;
+(3) we know there is NO edge;
+(4) we DO NOT know if there is an edge. 
+
+Corresponding edge weights are:
+case 1: measured value;
+case 2: \Robject{NA};  
+case 3: \Robject{Inf};
+case 4: TO-BE-DETERMINED
+
+When there is a loop of negative weight between two vertices, the distance
+between them is \Robject{-Inf}.
+
+%%FIXME: yes, but I think not available is different than you are
+%%using it here. Vince seemed to have in mind the idea that there
+%%would be some subject matter knowledge that a node exists, but it
+%%has not yet been measured.
+
+The shortest path problem is to find a path between two vertices where the
+sum of all the edge weights on this path is minimum.
+
+There are two sets of algorithms available: 
+(1) find shortest paths between a single vertex, say, {\em source s}, and 
+all other vertices, i.e., {\em V-s}, 
+available algorithms are: {\em Dijkstra's}, {\em Bellman Ford's} and {\em DAG},
+and 
+(2) find shortest paths between all pairs of vertices, available algorithms 
+are: {\em Johnson's} and {\em Floyd Warshall's}.
+
+%%FIXME: I think it would be helpful to first list the possibilities,
+%%maybe with a brief description of what they do, say in a table, then
+%%have more complete examples in the sections. Otherwise, it is hard
+%%for a reader to see what we have.
+
+{\em Dijkstra's algorithm } is for the single-source shortest-paths problem on
+graphs (directed or undirected) with non-negative weights on edges.
+If all the edges have the same weight, use depth-first-search instead.
+
+<<dijkdemo1>>=
+nodes(dijk)
+edgeWeights(dijk)
+dijkstra.sp(dijk)
+@
+
+The function \Rfunction{dijkstra.sp} finds the shortest paths from A,
+which is the first node in the node list - default source, 
+to all other vertices in the graph: {\em B, C, D, E}, shown in the
+{\em distances} part.  
+The {\em penult} shows TO-BE-FILLED-IN.
+
+For instance, edge {\em A->C} exists and carries a weight of 1, 
+so the shortest path from {\em A} to {\em C} is 1;
+the shortest path from {\em A} to {\em B} goes through 
+{\em A->C->D->E->B} and has weight of 6 (1+3+1+1).
+
+%%the use of penult is unfortunate. This is very hard for non-native
+%%speakers and should have been penultimate, if anything. But mostly
+%%it needs a good description of what it is and what it can be used
+%%for --- Vince?
+
+<<dijkdemo2>>=
+nodes(ospf)[6]
+dijkstra.sp(ospf,nodes(ospf)[6])
+sp.between(ospf, "RT6", "RT1")
+@
+
+The first part of this example finds the shortest paths from {\em start RT6}
+to all the other vertices in the graph, and the second part finds the shortest
+path between two vertices: {\em RT6} and {\em RT1}.  
+
+\begin{figure}
+@
+<<figospf, fig=TRUE, echo=false>>=
+z <- plot(ospf)
+@
+\caption{Network example from BGL.}
+\end{figure}
+
+{\em Bellman-Ford's algorithm} is for the single-source shortest-paths problem
+on graphs (directed or undirected) with both positive and negative
+edge weights.  The default source is the first entry in the list of nodes
+in the graph.   
+
+<<bellmanfordDemo>>=
+dd <- coex2
+nodes(dd)
+bellman.ford.sp(dd)
+bellman.ford.sp(dd,nodes(dd)[2])
+@
+
+The first \Rfunction{bellman.ford.sp} returns the shortest paths from 
+{\em start A}, which is the first vertex on the node list, 
+to all other vertices.  The second call shows the shortest paths from
+{\em start B} to all other vertices, since there is no path from {\em B} to
+{\em A}, the {\em distance} between them is \Robject{Inf}.
+
+
+The {\em DAG algorithm} is for the single-source shortest-paths problem on a
+weighted, directed acyclic graph (DAG), which is more efficient for DAG than
+both Dijkstra's and Bellman-Ford's algorithms.  When all the edges have the
+same weight, use depth-first-search instead.
+
+<<DAGDemo>>=
+dd <- coex2
+dag.sp(dd)
+dag.sp(dd,nodes(dd)[2])
+@
+
+It's easy to see that {\em conn2.gxl} doesn't contain any cycle, so we could
+use function \Rfunction{dag.sp} on it.  The first example finds the
+shortest paths from the {\em start A} to all other vertices.  The second example
+finds the shortest paths from {\em start B} to all other vertices, since no
+path goes from {\em B} to {\em A}, the distance is {\em Inf}.
+
+
+{\em Johnson's algorithm} finds the shortest path between every pair of
+vertices in a sparse graph.  Its time complexity is {\it O(V E log V)}.
+
+<<johnsonDemo>>=
+zz <- joh
+edgeWeights(zz)
+johnson.all.pairs.sp(zz)
+@
+\begin{figure}
+<<figjoh, fig=TRUE, echo=false>>=
+z <- plot(zz)
+@
+\caption{Example Johnson-all-pairs-shortest-paths example}
+\end{figure}
+
+This example uses a graph with negative edge weights.
+
+The shortest paths between all pairs of vertices are presented in the matrix,
+entry [i, j] gives the distance from vertex {\em i} to vertex {\em j}.
+For example, the shortest path from vertex {\em c} to vertex {\em d} is of
+length 5; the shortest path from vertex {\em a} to vertex {\em e} is of
+length -4, since edge {\em a->e} is available and of distance -4; the shortest
+distance from {\em a} to {\em c} is -3.
+
+
+{\em Floyd-Warshall's algorithm} finds the shortest path between every pair
+of vertices in a dense graph.
+
+<<floydwarshallDemo>>=
+floyd.warshall.all.pairs.sp(coex)
+@
+All edge distances are assumed to be 1, if not given.  Since the graph is
+undirected, the distance matrix is symmetric, for example, distance from
+{\em C} to {\em G} is the same as that from {\em G} to {\em C}.
+
+
+\subsection{Minimum spanning tree}
+
+Minimum-spanning-tree (MST) problem is to find a subset of edges that 
+connect all the vertices, contains no cycles and have the minimum weight sum.
+
+There are two algorithms available: {\em Kruskal's algorithm} and
+{\em Prim's algorithm}.  Both are for undirected graphs with weighted edges,
+and both return a list of edges, weights and nodes determining MST. 
+
+The \Rfunction{mstree.kruskal} function finds the MST 
+by Kruskal's algorithm.
+
+<<KMSTdemo>>=
+mstree.kruskal(km)
+@
+
+This graph is treated as undirected graph with corresponding weights.
+MST consists of 4 edges, {\em A->C, D->E, E->A, B->D}, each is of weight 1.
+
+The \Rfunction{mstree.prim} function finds the MST by Prim's algorithm.
+
+<<primDemo>>=
+mstree.prim(coex2)
+@
+
+The graph is treated as undirected graph with default weight 1.  MST consists
+of 7 edges, {\em A->B, A->C, A->D, C->E, D->H, E->F, C->G}.
+
+
+\subsection{Connected components }
+
+There are several algorithms available for this group of problems.
+
+A {\em connected component} of an undirected graph is a subgraph that for
+any two vertices in this subgraph, {\em u} and {\em v}, there's a path from
+{\em u} to {\em v}.
+
+The \Rfunction{connectedComp} function computes the connected components 
+in an undirected graph.
+
+<<conndemo>>=
+km1 <- km
+km1 <- graph::addNode(c("F","G","H"), km1)
+km1 <- addEdge("G", "H", km1, 1)
+km1 <- addEdge("H", "G", km1, 1)
+connectedComp(ugraph(km1))
+@
+
+<<figkm1, fig=TRUE, echo=false, results=hide, include=FALSE >>=
+plot(km1, main="Modified Kruskal MST example")
+@
+
+\begin{figure}[tp]
+\begin{center}
+\begin{tabular}{cc}
+\includegraphics[width=0.49\textwidth]{RBGL-figkmst} &
+\includegraphics[width=0.49\textwidth]{RBGL-figkm1} \\
+\end{tabular}
+\end{center}
+\caption{\label{fig:graphex}%
+Kruskal MST examples. }
+\end{figure}
+
+The original graph has one connected component. 
+After we add three vertices, {\em F, G, H} and an edge {\em G-H}, make the 
+graph {\em undirected}, the modified graph has three connected components now.
+
+A {\em strongly connected component} of a directed graph is a connected 
+subgraph that for every pair of vertices in this subgraph, {\em u} and {\em v},
+there are both a path from {\em u} to {\em v} and a path from {\em v} to 
+{\em u}.
+
+The \Rfunction{strongComp} function computes the strongly connected components 
+in a directed graph.
+
+<<sconndemo>>=
+km2 <- km
+km2 <- graph::addNode(c("F","G","H"), km2)
+km2 <- addEdge("G", "H", km2, 1)
+km2 <- addEdge("H", "G", km2, 1)
+strongComp(km2)
+@
+
+After adding three vertices, {\em F, G, H} and an edge {\em G-H},
+there are three strong components in the graph now.
+
+
+A {\em biconnected} graph is a connected graph that removal of any single vertex
+doesn't disconnect it.  If the removal of a vertex increases the number of
+components in a graph, this vertex is call an {\em articulation point}.
+
+The \Rfunction{biConnComp} function computes the biconnected components 
+in an undirected graph.
+The \Rfunction{articulationPoints} function finds all the articulation points 
+in an undirected graph.
+
+<<biConnCompdemo>>=
+biConnComp(bicoex)
+articulationPoints(bicoex)
+@
+
+\begin{figure}
+<<figbicoex, fig=TRUE, echo=false>>=
+z <- plot(bicoex)
+@
+\caption{Biconnected components example from Boost library.}
+\end{figure}
+
+There are 4 biconnected components in the example:
+one with vertices {\em B, C, D} and edges {\em B-C, C-D, B-D} labeled 0,
+one with vertices {\em A, B, E, F} and edges {\em A-B, B-E, E-F, A-F} labeled 1,
+one with vertices {\em G, H, I} and edges {\em G-I, G-H, I-H} labeled 2, and
+one with vertices {\em A, G} and edges {\em A-G} labeled 3.
+
+There are 3 articulation points in the example: {\em A, B, G}.  It's easy to 
+see removing any one of them will result in more connected components.
+
+When you {\em add} edges to an undirected graph and want to get updated 
+information on the connected components, you could use the following functions:
+\Rfunction{init.incremental.components} function to initialize the process;
+after adding edges to the graph, use \Rfunction{incremental.components} 
+function to update the information on the connected components; 
+use \Rfunction{same.component} function to find out
+if two vertices are in the same connected component.
+
+Currently, only one incremental graph is allowed at any given time.  To
+start on a new graph, you need to call \Rfunction{init.incremental.components}
+first.
+
+<<incrCompdemo>>=
+jcoex <- join(coex, hcs)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "F")
+same.component(jcoex, "A", "A1")
+jcoex <- addEdge("A", "A1", jcoex)
+x <- init.incremental.components(jcoex)
+incremental.components(jcoex)
+same.component(jcoex, "A", "A1")
+@
+
+\begin{figure}
+<<figjcoex, fig=TRUE, echo=false>>=
+z <- plot(jcoex)
+@
+\caption{Example on incremental components: a graph connecting coex and hcs.}
+\end{figure}
+
+In the first part of this example, we join two separate graphs together, 
+the resulting graph contains two connected components.  
+Vertices {\em A} and {\em F} are in the same connected component, while
+vertices {\em A} and {\em A1} are not in the same connected component.
+
+In the second part of the example, we add an edge connecting {\em A} and 
+{\em X}, which effectively connects the two subgraphs, we have only one 
+connected component left, which consists of all the vertices from the 
+two original graphs, {\em A} and {\em A1} are in the same connected component
+now.
+
+
+\subsection{Maximum Flow}
+
+The functions, \Rfunction{edmonds.karp.max.flow} and 
+\Rfunction{push.relabel.max.flow} are
+available to find the maximum flow between source and sink.
+
+<<MaxFlowdemo>>=
+edgeWeights(dijk)
+edmonds.karp.max.flow(dijk, "B", "D")
+push.relabel.max.flow(dijk, "C", "B")
+@
+
+Call to \Rfunction{edmonds.karp.max.flow} finds the maximum flow of 2 from 
+{\em B} to {\em D}: one part of flow 1 is {\em B -> D} directly, another
+part of flow 1 is {\em B -> E -> A -> C -> D}.
+
+Call to \Rfunction{push.relabel.max.flow} find the maximum flow of 8 from 
+{\em C} to {\em B}: one part of flow 7 is {\em C -> B} directly, another 
+part of flow 1 is {\em C -> D -> E -> B}.
+
+You can see the flow on each edge in the output, and each is no more than
+the capacity of the edge.
+
+\subsection{Sparse Matrix Ordering}
+
+There are three functions available in this category: 
+\Rfunction{cuthill.mckee.ordering}, \Rfunction{minDegreeOrdering} and
+\Rfunction{sloan.ordering}.
+
+{\em Cuthill-McKee's algorithm} tries to reduce the bandwidth of a graph by
+renumbering its vertices.  The outputs are the vertices in the new ordering
+and reverse ordering.
+
+{\em Minimum degree Ordering} is one approach that tries to reduce fill-ins
+in matrix reordering, which turns a system of equations {\em A x = b} to
+{\em (P A PT)(P x) = P b}.
+
+{\em Sloan Ordering} tries to reduce the profile and wavefront of a graph by
+renumbering its vertices.
+
+<<SparseMatrixOrderingdemo>>=
+dijk1 <- ugraph(dijk)
+cuthill.mckee.ordering(dijk1)
+minDegreeOrdering(dijk1)
+sloan.ordering(dijk1)
+@
+
+TODO: EXPLAIN THESE OUTPUT.
+
+
+\subsection{Edge connectivity and minimum disconnecting set}
+
+%%FIXME: I am a bit confused about the relationship between the stuff
+%%here, and the cutsets and betweenness centrality stuff? Is there
+%%anything that should be commented on?
+
+For a single connected undirected graph, function {\em edgeConnectivity}
+calculates the minimum number of edges that have to be removed to create
+two disconnected components.  No edge weight is taken into account and the 
+output is the edges that need to be removed.
+
+This is very similar to the {\em minCut} algorithm, which takes the edge 
+weights into account when removing edges and outputs the vertices on the 
+two disconnected components.
+
+<<edgeConndemo>>=
+edgeConnectivity(coex)
+@
+
+Mimimum of two edges must be removed to create two disconnected components:
+edges {\em D-E} and {\em D-H}.
+
+
+\subsection{Topological sort}
+
+The \Rfunction{tsort} function will return the names of vertices from a DAG
+in topological sort order.
+
+<<tsortDemo1>>=
+tsort(FileDep)
+@
+
+Note that if the input graph is not a DAG, BGL {\tt topological\_sort}
+will check this and throw 'not a dag'.  This is crudely captured
+in the interface (a message is written to the console and zeroes are returned).
+
+<<tsortDemo2>>=
+FD2 <- FileDep
+# now introduce a cycle
+FD2 <- addEdge(from="bar_o", to="dax_h", FD2)
+tsort(FD2)
+@
+
+%\subsection{Layout}
+%
+%If you want to simply draw a graph, you should consider using package 
+%{\em Rgraphviz}. 
+%
+%Package {\em Rgraphviz} provides a lot more functionalities in graph layout,
+%you can use it to do the actual layouts: 
+%a. "neato" uses Kamada-Kawai algorithm to make spring model layout, 
+%b. "fdp" uses Fruchterman-Reingold algorithm to make spring model layout,
+%c. "circo" does circular layout.
+%See Figure~\ref{fig:graphlayout} for an example.
+%
+%<<Layoutdemo>>=
+%# library(Rgraphviz)
+%plot(coex, "neato")
+%@
+%<<figneato, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%z <- plot(coex, "neato")
+%@
+%
+%The following functions are interfaces to those in BGL, they only calculate 
+%the (x, y)-coordinates of the vertices in the graph.  The actual layout is 
+%achieved with additional function, we provide an example on how to do so.
+%
+%Following functions are available:
+%
+%The \Rfunction{randomGraphLayout} function puts the vertices randomly 
+%on a plane;
+%
+%The \Rfunction{circleLayout} function puts the vertices as vertices of 
+%a regular polygon;
+%
+%The \Rfunction{kamadaKawaiSpringLayout} function is for connected, 
+%undirected graphs, it treats the edges as springs and tries to minimize 
+%the energy of the whole system;
+%
+%The \Rfunction{fruchtermanReingoldForceDirectedLayout} function is for 
+%unweighted, undirected, possibly disconnected graphs, it treats the edges 
+%as forces that pull vertices together, no-edges as forces that push 
+%vertices apart, vertices move to a position as environment changes; 
+%initial positions of the vertices are set randomly by calling 
+%\Rfunction{randomGraphLayout}.  Notice that the choice of "width" and 
+%"height" values has dramatic impact on the performance.
+%
+%<<Layoutdemo2>>=
+%randomGraphLayout(coex)
+%circleLayout(coex)
+%kamadaKawaiSpringLayout(coex)
+%fruchtermanReingoldForceDirectedLayout(coex, 10, 10)
+%@
+%
+%Outputs are the (x, y)-coordinates of the vertices in the layout.
+%
+%If you want to draw the graphs based on the calculated coordinates, you need 
+%an additional function.  The following is an example.
+%
+%<<Layoutdemo3>>=
+%crudeGraphPlot <- function(g, alg=circleLayout, ...) {
+%#
+%# the alg parameter is a function that computes the
+%# layout of g, returning it as a list of length 1
+%# with two rows: top row is x coordinates, bottom is
+%# y coordinates, and node names are used as colnames
+%# the ... are passed to segments()
+%#
+%  layout <- alg(g)
+%  plot( layout[1,], layout[2,], pch=nodes(g), axes=FALSE,
+%    xlab="", ylab="", main=substitute(g), cex=1.4 )
+%  ee <- edges(g)
+%  src <- names(ee)
+%  ds <- function(nn1, nn2, lob) segments(lob[1,nn1], lob[2,nn1],
+%        lob[1,nn2], lob[2,nn2], ...)
+%  for (s in src) sapply(ee[[s]], function(x) ds(s, x, layout))
+%  invisible(NULL)
+%}
+%
+%crudeGraphPlot(coex)
+%crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green")
+%@
+%
+%<<figlayout1, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%crudeGraphPlot(coex)
+%@
+%
+%<<figlayout2, fig=TRUE, echo=false, results=hide, include=FALSE>>=
+%crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green")
+%@
+%
+%\begin{figure}[tp]
+%\begin{center}
+%\begin{tabular}{cc}
+%\includegraphics[width=0.49\textwidth]{RBGL-figneato} &
+%\includegraphics[width=0.49\textwidth]{RBGL-figlayout1} \\
+%\includegraphics[width=0.49\textwidth]{RBGL-figlayout2} \\
+%\end{tabular}
+%\end{center}
+%\caption{\label{fig:graphlayout}%
+%a) plot(coex, neato).
+%b) crudeGraphPlot(coex).
+%c) crudeGraphPlot(coex, alg=kamadaKawaiSpringLayout, col="green"). }
+%\end{figure}
+%
+%Call crudeGraphPlot(coex) gives the default circular layout on your graphics device.
+%
+%Call crudeGraphPlot(coex, alg=kamada.kawai.spring.layout, col="green") shows you the spring layout with green edges, see Figure~\ref{fig:graphlayout}.
+%
+%
+\subsection{Isomorphism}
+
+The \Rfunction{isomorphism} function determines if two graphs are isomorphism, 
+i.e., determines if there is a one-to-one mapping {\em f} of vertices from 
+one graph {\em g1} to the other {\em g2} such that edge {\em u -> v} is in
+{\em E(g1)} iff edge {\em f(u) -> f(v)} exists and is in {\em E(g2)}.
+
+<<Isomorphismdemo>>=
+isomorphism(dijk, coex2)
+isomorphism(coex2i, coex2)
+@
+\begin{figure}
+<<figcoex2i, fig=TRUE, echo=false>>=
+z <- plot(coex2i)
+@
+\caption{Example conn2i}
+\end{figure}
+
+The function handles both directed and undirected graphs. 
+There are more vertices in graph {\em conn2} than {\em dijkstra}, so
+it's impossible to find a one-to-one mapping between them.
+One the other hand, graph {\em conn2i} is basically the same graph as 
+{\em conn2} except the vertices have different names, so they are isomorphism.
+
+
+\subsection{Vertex Coloring}
+
+The \Rfunction{sequential.vertex.coloring} function assigns colors, 
+as numbers 0, 1, 2, ..., to vertices in a graph
+so that two vertices connected by an edge are of different colors.  It does not
+guarantee that minimum number of colors is used, and the result depends on the
+input ordering of the vertices in the graph.
+
+<<VertexColoringdemo>>=
+sequential.vertex.coloring(coex)
+@
+
+We need 4 colors for the vertices of this graph, one color scheme is to give
+color 0 to vertices {\em A, E}, color 1 to vertices {\em B, H},
+color 2 to vertices {\em C, F} and color 3 to vertices {\em D, G}.
+
+
+%\subsection{Transitive Closure}
+%
+%Directed graphs can be used to represent relations, $R$, on a finite set
+%of objects, V. For example, the objects could be integers and the
+%relation could be less than. An edge exists in the graph, between two
+%nodes, $(u,v)$ if the $(u,v) \in R$. A \textit{transitive digraph} is
+%a digraph whose corresponding relation is transitive. That is, if
+%there is an edge $(u, v)$ and an edge $(v, w)$, then there must be an
+%edge $(u, w)$. Finally, the transitive closure, $R^*$ of an arbitrary
+%relation $R$ is the smallest transitive relation that contains $R$.
+%
+%Finally, if $D$ is the directed graph that represents the relation
+%$R$, then the directed graph $D^*$ that represents the relation $R^*$
+%is called the transitive closure of $D$.
+%
+%The function \Rfunction{transitive.closure} returns the transitive
+%closure of a directed graph.
+%
+%In the code below we compute the transitive closure for the example
+%graph \Robject{dijk} and then plot both the original graph, and the
+%transitive closure in Figure~\ref{fig:graphTC}.
+%
+%%%FIXME: surely this should return a graph of the same class as the
+%%%input, not some list? Not sure this is the most elegant, but it
+%%%seems to work - someone should check that the output is actually the
+%%%transitive closure - I do not much like the self-loops, but maybe
+%%%they are part of it.
+%
+%TO-BE-FINALIZED:
+%The transitive closure {\em tc} of a graph {\em g} is a graph that 
+%contains the same set of vertices as {\em g}, and there is an edge from 
+%{\em u} to {\em v} in {\em tc} iff there is a path from {\em u} to {\em v}
+%in {\em g}.
+%
+%<<transClosuredemo>>=
+%dijk.tc = transitive.closure(dijk)
+%@
+%
+%<<figdijkTC, fig=TRUE, echo=FALSE, results=hide, include=FALSE  >>=
+%  plot(dijk.tc, main="b) Transitive closure")
+%@
+%
+%\begin{figure}[tp]
+%\begin{center}
+%\begin{tabular}{cc}
+%\includegraphics[width=0.49\textwidth]{RBGL-figdijk} &
+%\includegraphics[width=0.49\textwidth]{RBGL-figdijkTC} \\
+%\end{tabular}
+%\end{center}
+%\caption{\label{fig:graphTC}%
+%a) The graph for Dijkstra's example.
+%b) The transitive closure of the graph in panel a)}
+%\end{figure}
+%
+%In this graph, you can reach each and every vertex from any vertex.
+%
+
+\subsection{Wavefront, Profiles}
+
+TODO: EXPLAIN THESE TERMS
+
+The following functions are available: 
+\Rfunction{ith.wavefront}, \Rfunction{maxWavefront}, 
+\Rfunction{aver.wavefront} and \Rfunction{rms.wavefront}.
+
+<<wavefrontdemo>>=
+ss <- 1
+ith.wavefront(dijk, ss)
+maxWavefront(dijk)
+aver.wavefront(dijk)
+rms.wavefront(dijk)
+@
+
+TODO: EXPLAIN THESE RESULTS
+
+
+\subsection{Betweenness Centrality and Clustering}
+
+{\em Betweenness centrality} of a vertex (or an edge) measures its importance
+in a graph, i.e., among all the shortest paths between every pair of vertices
+in the graph, how many of them have to go through this vertex (or edge).
+{\em Relative} betweenness centrality is calculated by scaling the 
+{\em absolute} betweenness centrality by factor {\em 2/((n-1)(n-2))},
+where {\em n} is the number of vertices in the graph.
+
+The \Rfunction{brandes.betweenness.centrality} function implements 
+Brandes' algorithm in calculating betweenness centrality.
+
+The \Rfunction{betweenness.centrality.clustering} function implements 
+clustering in a graph based on edge betweenness centrality.
+
+TODO: EXPLAIN MORE
+
+<<Centralitydemo>>=
+brandes.betweenness.centrality(coex)
+betweenness.centrality.clustering(coex, 0.1, TRUE)
+@
+
+TODO: EXPLAIN THE RESULTS
+
+
+\section{Algorithms built on RBGL}
+
+\subsection{Min-Cut}
+
+Given an undirected graph G=(V, E) of a single connected
+component, a {\em cut} is  a partition of the set of vertices into two
+non-empty subsets S and V-S, a {\em cost} is the weight sum of edges that
+are incident on one vertex in S and one vertex in V-S.  The
+min-cut problem is to find a cut (S, V-S) of minimum cost.
+
+For simplicity, subset {\em S} is the smaller of the two.
+
+<<mincutdemo>>=
+minCut(coex)
+@
+
+Currently all edge weights are assumed to be 1, minimum cut is of weight 2, 
+it will partition the graph into two subsets: subset {\em A, B, C, D} and 
+subset {\em E, H, F, G}.
+
+
+\subsection{highlyConnSG}
+
+A graph {\em G} with {\em n} vertices is highly connected if its connectivity
+{\em k(G) > n/2}.  Function {\em highlyConnSG} partitions a graph into a set
+of highly connected subgraphs, by using minimum-cut algorithm repeatedly.
+To improve performance, it takes special care of singletons, low degree
+vertices and merges clusters.
+
+<<highlyConnSGdemo>>=
+highlyConnSG(coex)
+highlyConnSG(hcs)
+@
+
+In graph {\em conn}, two highly-connected-subgraphs are found: subgraph
+with vertices {\em A, B, C, D} and subgraph with vertices {\em E, H, F, G}.
+
+In graph {\em hcs}, 3 highly-connected-subgraphs are found: subgraph
+with vertices {\em A1, A2, A3, A4, A5}, subgraph with vertices 
+{\em B1, B2, B3, B4} and subgraph with vertices {\em X, Y, Z}.
+
+
+\section{Algorithms independent from RBGL}
+\subsection{maxClique}
+
+A {\em clique} is a complete subgraph, i.e., there is an edge between 
+every pair of vertices.
+
+{\em Maximum Clique} problem is to find the largest clique in a graph.  
+This problem is NP-complete, which means it cannot be solved by any known
+polynomial algorithm.
+
+Function {\em maxClique} implements the algorithm from {\em Finding all 
+cliques of an undirected graph}, by C. Bron and J. Kerbosch (CACM, Sept 1973,
+Vol 16, No. 9.), which finds all the cliques in a graph.
+
+<<MaxCliquedemo>>=
+maxClique(coex)
+maxClique(hcs)
+@
+
+In graph {\em conn}, 3 cliques are found:
+clique with vertices {\em D, B, C, A},
+clique with vertices {\em D, E, H} and
+clique with vertices {\em F, E, H, H}.
+
+In graph {\em hcs}, 10 cliques are found.  For instance, vertices 
+{\em A2, A4, A3} form a clique, vertices {\em B1, Y} form a clique.
+
+
+\subsection{is.triangulated}
+
+A graph is {\em triangulated} if all cycles of length 4 or more have a chord.
+The \Rfunction{is.triangulated} function returns TRUE or FALSE, accordingly.
+
+We implemented the following algorithm from {\em Combinatorial Optimization: algorithms and complexity} (p. 403) by C. H. Papadimitriou, K. Steiglitz:
+G is chordal iff either G is an empty graph, or there is a {\em v} in {\em V}
+such that (i) the neighborhood of {\em v}, i.e., {\em v} and its adjacent vertices, forms a clique, and (ii) recursively, {\em G-v} is chordal.
+
+<<IsTriangulateddemo>>=
+is.triangulated(coex)
+is.triangulated(hcs)
+@
+
+\subsection{separates}
+
+Function {\em separates} determines if a subset of vertices separates two other
+subsets of vertices, and returns TRUE or FALSE, accordingly.
+
+<<Separatesdemo>>=
+separates("B", "A", "E", km)
+separates("B", "A", "C", km)
+@
+
+\subsection{kCores}
+A {\em k-core} in a graph is a subgraph where each vertex is adjacent to 
+at least {\tt k} other vertices in the same subgraph.
+
+Function {\em kCores} finds all the k-cores in a graph.  It returns the core 
+numbers for all the nodes in the graph.  When the given graph is directed, 
+you can choose whether in-degree, out-degree or both should be considered.
+
+The k-core of a graph is not a necessarily connected subgraph.  If i > j, 
+the i-core of a graph contains the j-core of the same graph. 
+
+The implementation is based on the algorithm by V. Batagelj and M. Zaversnik, 2002.
+
+<<kCoresdemo1>>=
+kCores(kcoex)
+kcoex2 <- coex2
+kCores(kcoex2)
+kCores(kcoex2, "in")
+kCores(kcoex2, "out")
+g1 <- addEdge("C", "B", kcoex2)
+kCores(g1, "in")
+g2 <- addEdge("C", "A", kcoex2)
+kCores(g2, "out")
+@
+\begin{figure}
+<<figkcores, fig=TRUE, echo=false>>=
+z <- plot(kcoex)
+@
+\caption{K-cores Example.}
+\label{fdkcore}
+\end{figure}
+
+The example on directed graph, "conn2", turns out to be a waterfall-like graph.
+If we order the nodes as: A, B, C, D, E, F, H, G, all the edges go in the same
+direction, i.e., i -> j, i < j.
+
+Let's consider in-degree-only case: A has no in-edge so it is 0-core; after you
+eliminate A, no in-edge to B, so B is 0-core; continue this, we could see that
+there's no subset of nodes that each and every single node has 1 in-degree.
+Therefore, they are all of 0-core.
+
+For out-degree-only case: G has no out-edge, so it's 0-core; after eliminating
+G, F has no out-edge, so F is 0-core; continue this process, we could see that
+there's no subset of nodes that each and every single node has 1 out-edge.
+Therefore, they are all of 0-core.
+
+If we add edge(s) to break the waterfall-like property, {\em C->B}, {\em C->A}, 
+separately, we could see the changes in the core numbers that are consistant 
+with the analysis above.
+
+
+\subsection{kCliques}
+
+In social network analysis, a k-cliques is a maximum subgraph that the shortest distance between any two nodes is no more than k.
+
+Function {\em kCliques} finds all the k-cliques in an undirected graph (k = 1, ..., N, where N is the length of the longest shortest-path).  It returns all the k-cliques.
+
+Let D be a matrix, D[i][j] is the shortest path from node i to node j.  
+Algorithm is outlined as following.
+o. use Johnson's algorithm to fill D; let N = max(D[i][j]) for all i, j;
+o. each edge is a 1-clique by itself;
+o. for k = 2, ..., N, try to expand each (k-1)-clique to k-clique:
+    o. consider a (k-1)-clique the current k-clique KC;
+    o. repeat the following:
+          if for all nodes j in KC, D[v][j] <= k, add node v to KC;
+    o. eliminate duplicates;
+o. the whole graph is N-clique.
+
+<<kCliquesdemo>>=
+kCliques(kclex)
+@
+\begin{figure}
+<<figkcliques, fig=TRUE, echo=false>>=
+z <- plot(kclex)
+@
+\caption{K-cliques Example.}
+\label{fdkcliques}
+\end{figure}
+
+
+\end{document}
+
+
diff --git a/vignettes/filedep.eps b/vignettes/filedep.eps
new file mode 100644
index 0000000..c1db976
--- /dev/null
+++ b/vignettes/filedep.eps
@@ -0,0 +1,544 @@
+%!PS-Adobe-3.0
+%%DocumentNeededResources: font Helvetica
+%%+ font Helvetica-Bold
+%%+ font Helvetica-Oblique
+%%+ font Helvetica-BoldOblique
+%%+ font Symbol
+%%DocumentMedia: special 432 432 0 () ()
+%%Title: R Graphics Output
+%%Creator: R Software
+%%Pages: (atend)
+%%BoundingBox: 0 0 432 432
+%%EndComments
+%%BeginProlog
+/bp  { gs gs } def
+% begin .ps.prolog
+/gs  { gsave } def
+/gr  { grestore } def
+/ep  { showpage gr gr } def
+/m   { moveto } def
+/l  { rlineto } def
+/np  { newpath } def
+/cp  { closepath } def
+/f   { fill } def
+/o   { stroke } def
+/c   { newpath 0 360 arc } def
+/r   { 4 2 roll moveto 1 copy 3 -1 roll exch 0 exch rlineto 0 rlineto -1 mul 0 exch rlineto closepath } def
+/p1  { stroke } def
+/p2  { gsave bg setrgbcolor fill grestore newpath } def
+/p3  { gsave bg setrgbcolor fill grestore stroke } def
+/t   { 6 -2 roll moveto gsave rotate
+       ps mul neg 0 2 1 roll rmoveto
+       1 index stringwidth pop
+       mul neg 0 rmoveto show grestore } def
+/cl  { grestore gsave newpath 3 index 3 index moveto 1 index
+       4 -1 roll lineto  exch 1 index lineto lineto
+       closepath clip newpath } def
+/rgb { setrgbcolor } def
+/s   { scalefont setfont } def
+/R   { /Font1 findfont } def
+/B   { /Font2 findfont } def
+/I   { /Font3 findfont } def
+/BI  { /Font4 findfont } def
+/S   { /Font5 findfont } def
+1 setlinecap 1 setlinejoin
+% end   .ps.prolog
+%%IncludeResource: font Helvetica
+/Helvetica findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding ISOLatin1Encoding def
+  currentdict
+  end
+/Font1 exch definefont pop
+%%IncludeResource: font Helvetica-Bold
+/Helvetica-Bold findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding ISOLatin1Encoding def
+  currentdict
+  end
+/Font2 exch definefont pop
+%%IncludeResource: font Helvetica-Oblique
+/Helvetica-Oblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding ISOLatin1Encoding def
+  currentdict
+  end
+/Font3 exch definefont pop
+%%IncludeResource: font Helvetica-BoldOblique
+/Helvetica-BoldOblique findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  /Encoding ISOLatin1Encoding def
+  currentdict
+  end
+/Font4 exch definefont pop
+%%IncludeResource: font Symbol
+/Symbol findfont
+dup length dict begin
+  {1 index /FID ne {def} {pop pop} ifelse} forall
+  currentdict
+  end
+/Font5 exch definefont pop
+%%EndProlog
+%%Page: 1 1
+bp
+59.04 73.44 401.76 372.96 cl
+0 0 0 rgb
+0.75 setlinewidth
+[] 0 setdash
+186.73 344.09 17.15 c p1
+238.48 303.79 17.15 c p1
+335.13 303.79 17.15 c p1
+90.08 344.09 17.15 c p1
+99.11 303.79 17.15 c p1
+99.11 223.20 17.15 c p1
+195.76 263.50 17.15 c p1
+195.76 223.20 17.15 c p1
+177.15 182.90 17.15 c p1
+361.96 223.20 17.15 c p1
+370.72 182.90 17.15 c p1
+292.42 263.50 17.15 c p1
+274.07 182.90 17.15 c p1
+274.07 142.61 17.15 c p1
+274.07 102.31 17.15 c p1
+np
+200.42 333.42 m
+2.10 -1.66 l
+2.18 -1.71 l
+2.24 -1.74 l
+2.29 -1.76 l
+2.31 -1.78 l
+2.32 -1.78 l
+2.32 -1.76 l
+2.28 -1.74 l
+2.24 -1.71 l
+2.17 -1.66 l
+o
+np
+222.87 316.12 m
+1.92 -1.66 l
+o
+np
+219.17 315.54 m
+5.62 -1.08 l
+-1.88 5.40 l
+o
+np
+170.57 336.50 m
+-4.71 -2.15 l
+-5.07 -2.32 l
+-5.32 -2.44 l
+-5.51 -2.52 l
+-5.60 -2.57 l
+-5.62 -2.57 l
+-5.56 -2.54 l
+-5.41 -2.48 l
+-5.17 -2.36 l
+-4.87 -2.22 l
+o
+np
+117.73 312.33 m
+-2.46 -1.19 l
+o
+np
+118.49 315.86 m
+-3.22 -4.72 l
+5.70 -0.43 l
+o
+np
+188.37 328.21 m
+0.51 -4.22 l
+0.53 -4.48 l
+0.55 -4.70 l
+0.56 -4.83 l
+0.56 -4.91 l
+0.54 -4.92 l
+0.54 -4.86 l
+0.50 -4.73 l
+0.48 -4.53 l
+0.43 -4.28 l
+o
+np
+193.57 281.75 m
+0.28 -2.37 l
+o
+np
+190.44 283.97 m
+3.41 -4.59 l
+2.27 5.24 l
+o
+np
+225.88 291.94 m
+-1.50 -1.44 l
+-1.54 -1.48 l
+-1.58 -1.50 l
+-1.60 -1.52 l
+-1.62 -1.53 l
+-1.62 -1.52 l
+-1.63 -1.52 l
+-1.61 -1.50 l
+-1.60 -1.48 l
+-1.58 -1.44 l
+o
+np
+210.00 277.01 m
+-1.91 -1.66 l
+o
+np
+209.96 280.75 m
+-1.87 -5.40 l
+5.61 1.08 l
+o
+np
+252.44 293.36 m
+2.26 -1.67 l
+2.35 -1.75 l
+2.41 -1.80 l
+2.45 -1.84 l
+2.48 -1.86 l
+2.48 -1.86 l
+2.48 -1.86 l
+2.45 -1.84 l
+2.40 -1.79 l
+2.34 -1.74 l
+o
+np
+276.54 275.35 m
+1.91 -1.42 l
+o
+np
+272.77 274.58 m
+5.68 -0.65 l
+-2.27 5.24 l
+o
+np
+317.61 298.81 m
+-8.36 -2.45 l
+-9.47 -2.77 l
+-10.30 -3.00 l
+-10.88 -3.16 l
+-11.20 -3.25 l
+-11.26 -3.27 l
+-11.06 -3.20 l
+-10.59 -3.08 l
+-9.86 -2.86 l
+-8.88 -2.58 l
+o
+np
+215.75 269.19 m
+-2.46 -0.72 l
+o
+np
+217.25 272.59 m
+-3.96 -4.12 l
+5.55 -1.37 l
+o
+np
+340.33 288.39 m
+1.38 -4.24 l
+1.48 -4.54 l
+1.56 -4.78 l
+1.63 -4.94 l
+1.65 -5.03 l
+1.66 -5.04 l
+1.65 -4.99 l
+1.61 -4.85 l
+1.54 -4.64 l
+1.45 -4.36 l
+o
+np
+355.94 240.98 m
+0.82 -2.37 l
+o
+np
+352.44 242.35 m
+4.32 -3.74 l
+1.08 5.61 l
+o
+np
+322.53 291.94 m
+-1.50 -1.44 l
+-1.54 -1.48 l
+-1.58 -1.50 l
+-1.60 -1.52 l
+-1.61 -1.53 l
+-1.63 -1.52 l
+-1.62 -1.52 l
+-1.62 -1.50 l
+-1.60 -1.48 l
+-1.58 -1.44 l
+o
+np
+306.65 277.01 m
+-1.91 -1.66 l
+o
+np
+306.61 280.75 m
+-1.87 -5.40 l
+5.61 1.08 l
+o
+np
+93.64 328.44 m
+0.09 -0.70 l
+0.13 -0.69 l
+0.14 -0.69 l
+0.16 -0.68 l
+0.16 -0.67 l
+0.16 -0.68 l
+0.16 -0.68 l
+0.15 -0.68 l
+0.12 -0.70 l
+0.10 -0.70 l
+o
+np
+95.01 321.57 m
+0.54 -2.13 l
+o
+np
+91.55 323.52 m
+4.00 -4.08 l
+1.54 5.50 l
+o
+np
+99.11 287.91 m
+0 -4.14 l
+0 -4.42 l
+0 -4.63 l
+0 -4.79 l
+0 -4.86 l
+0 -4.89 l
+0 -4.85 l
+0 -4.74 l
+0 -4.57 l
+0 -4.33 l
+o
+np
+99.11 241.69 m
+0 -2.61 l
+o
+np
+96.25 244.03 m
+2.86 -4.95 l
+2.86 4.95 l
+o
+np
+114.99 215.14 m
+3.94 -2.07 l
+4.22 -2.21 l
+4.44 -2.31 l
+4.58 -2.39 l
+4.66 -2.43 l
+4.68 -2.43 l
+4.63 -2.41 l
+4.51 -2.35 l
+4.34 -2.26 l
+4.09 -2.13 l
+o
+np
+159.08 192.15 m
+2.19 -1.19 l
+o
+np
+155.55 190.81 m
+5.72 0.15 l
+-3.00 4.87 l
+o
+np
+195.76 247.61 m
+0 -0.63 l
+0 -0.62 l
+0 -0.61 l
+0 -0.61 l
+0 -0.61 l
+0 -0.60 l
+0 -0.61 l
+0 -0.61 l
+0 -0.62 l
+0 -0.64 l
+o
+np
+195.76 241.45 m
+0 -2.37 l
+o
+np
+192.91 244.03 m
+2.85 -4.95 l
+2.86 4.95 l
+o
+np
+188.92 208.50 m
+-0.41 -0.86 l
+-0.41 -0.87 l
+-0.41 -0.88 l
+-0.40 -0.88 l
+-0.39 -0.89 l
+-0.39 -0.89 l
+-0.37 -0.89 l
+-0.37 -0.88 l
+-0.35 -0.87 l
+-0.33 -0.86 l
+o
+np
+185.09 199.73 m
+-1.10 -2.13 l
+o
+np
+183.71 203.31 m
+0.28 -5.71 l
+4.81 3.10 l
+o
+np
+193.57 176.03 m
+5.43 -2.25 l
+5.87 -2.44 l
+6.19 -2.59 l
+6.43 -2.69 l
+6.54 -2.74 l
+6.57 -2.75 l
+6.47 -2.71 l
+6.28 -2.63 l
+5.98 -2.49 l
+5.58 -2.31 l
+o
+np
+254.91 150.43 m
+2.46 -0.95 l
+o
+np
+251.72 148.59 m
+5.65 0.89 l
+-3.60 4.45 l
+o
+np
+365.25 207.56 m
+0.09 -0.71 l
+0.13 -0.69 l
+0.14 -0.69 l
+0.16 -0.68 l
+0.16 -0.67 l
+0.16 -0.68 l
+0.16 -0.68 l
+0.14 -0.68 l
+0.13 -0.69 l
+0.10 -0.71 l
+o
+np
+366.62 200.68 m
+0.54 -2.13 l
+o
+np
+363.16 202.63 m
+4.00 -4.08 l
+1.54 5.50 l
+o
+np
+354.02 176.03 m
+-5.35 -2.24 l
+-5.78 -2.42 l
+-6.12 -2.57 l
+-6.35 -2.65 l
+-6.48 -2.71 l
+-6.51 -2.72 l
+-6.42 -2.68 l
+-6.25 -2.60 l
+-5.95 -2.47 l
+-5.57 -2.30 l
+o
+np
+293.24 150.67 m
+-2.74 -1.19 l
+o
+np
+293.91 154.07 m
+-3.41 -4.59 l
+5.68 -0.66 l
+o
+np
+288.86 247.85 m
+-0.95 -4.22 l
+-1.01 -4.50 l
+-1.06 -4.73 l
+-1.10 -4.88 l
+-1.12 -4.96 l
+-1.13 -4.97 l
+-1.13 -4.92 l
+-1.10 -4.80 l
+-1.07 -4.60 l
+-1.01 -4.35 l
+o
+np
+278.18 200.92 m
+-0.55 -2.37 l
+o
+np
+275.96 204.02 m
+1.67 -5.47 l
+3.90 4.18 l
+o
+np
+274.07 167.02 m
+0 -0.63 l
+0 -0.62 l
+0 -0.62 l
+0 -0.60 l
+0 -0.61 l
+0 -0.60 l
+0 -0.61 l
+0 -0.62 l
+0 -0.62 l
+0 -0.63 l
+o
+np
+274.07 160.86 m
+0 -2.37 l
+o
+np
+271.21 163.44 m
+2.86 -4.95 l
+2.86 4.95 l
+o
+np
+274.07 126.73 m
+0 -0.64 l
+0 -0.62 l
+0 -0.61 l
+0 -0.61 l
+0 -0.61 l
+0 -0.60 l
+0 -0.61 l
+0 -0.61 l
+0 -0.62 l
+0 -0.64 l
+o
+np
+274.07 120.56 m
+0 -2.37 l
+o
+np
+271.21 123.14 m
+2.86 -4.95 l
+2.86 4.95 l
+o
+/ps 12 def R 12 s
+186.73 340.53 (dax_h) .5 0 0 t
+238.48 300.77 (yow_h) .5 0 0 t
+335.13 300.23 (boz_h) .5 0 0 t
+90.08 340.53 (zow_h) .5 0 0 t
+99.11 300.67 (foo_cpp) .5 0 0 t
+99.11 219.58 (foo_o) .5 0 0 t
+195.76 260.43 (bar_cpp) .5 0 0 t
+195.76 219.64 (bar_o) .5 0 0 t
+177.15 179.29 (libfoobar_a) .5 0 0 t
+361.96 220.21 (zig_cpp) .5 0 0 t
+370.72 179.92 (zig_o) .5 0 0 t
+292.42 261.59 (zag_cpp) .5 0 0 t
+274.07 181.00 (zag_o) .5 0 0 t
+274.07 139.62 (libzigzag_a) .5 0 0 t
+274.07 99.25 (killerapp) .5 0 0 t
+ep
+%%Trailer
+%%Pages: 1
+%%EOF
diff --git a/vignettes/filedep.pdf b/vignettes/filedep.pdf
new file mode 100644
index 0000000..c24651e
Binary files /dev/null and b/vignettes/filedep.pdf differ
diff --git a/vignettes/leloc.R b/vignettes/leloc.R
new file mode 100644
index 0000000..9417ab0
--- /dev/null
+++ b/vignettes/leloc.R
@@ -0,0 +1,12 @@
+leloc <- function(x,n=1,p=1,q=1,xoff=-20, yoff=-10){
+ s <- getSpline(x$edges[[n]],p)@cPoints
+ xs <- rep(NA,length(s))
+ ys <- rep(NA,length(s))
+ for (i in 1:length(s))
+  {
+  xs[i] <- s[[i]]@x
+  ys[i] <- s[[i]]@y
+  }
+ list(x=mean(xs)+xoff, y=mean(ys)+yoff)
+}
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-bioc-rbgl.git



More information about the debian-med-commit mailing list