Package RBGL. R topics documented: May 14, Version Title An interface to the BOOST graph library

Size: px
Start display at page:

Download "Package RBGL. R topics documented: May 14, Version Title An interface to the BOOST graph library"

Transcription

1 Version Title An interface to the BOOST raph library Packae RBGL May 14, 2018 Author Vince Carey Li Lon R. Gentleman Maintainer Bioconductor Packae Maintainer Depends raph, methods Imports methods Suests Rraphviz, XML, RUnit, BiocGenerics A fairly extensive and comprehensive interface to the raph alorithms contained in the BOOST library. License Artistic-2.0 URL LazyLoad yes biocviews GraphAndNetwork, Network R topics documented: astarsearch bandwidth bellman.ford.sp betweenness.centrality.clusterin bfs biconncomp boyermyrvoldplanaritytest brandes.betweenness.centrality chrobakpaynestraihtlinedrawin clusterincoef clusterincoefappr connectedcomp da.sp dijkstra.sp dominatortree edeconnectivity edmondsmaxcardinalitymatchin

2 2 R topics documented: edmondsoptimumbranchin extractpath FileDep floyd.warshall.all.pairs.sp profile raphgenerator hihlyconnsg incremental.components is.trianulated iskuratowskisubraph isomorphism isstraihtlinedrawin johnson.all.pairs.sp kcliques kcores lambdasets layout makebiconnectedplanar makeconnected makemaximalplanar max.flow maxclique maximumcycleratio mincut minimumcycleratio mstree.kruskal mstree.prim Orderin planarcanonicalorderin planarfacetraversal RBGL-defunct RBGL.overview removeselfloops separates sequential.vertex.colorin sloanstartendvertices sp.between stroncomp transitive.closure transitivity tsort wavefront Index 67

3 astarsearch 3 astarsearch Compute astarsearch for a raph Compute astarsearch for a raph Usae astarsearch() Aruments an instance of the raph class NOT IMPLEMENTED YET. TO BE FILLED IN a strin indicatin non-implementation Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) con <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) astarsearch(coex)

4 4 bandwidth bandwidth Compute bandwidth for an undirected raph Compute bandwidth for an undirected raph Usae bandwidth() Aruments an instance of the raph class with edemode undirected The bandwidth of an undirected raph G=(V, E) is the maximum distance between two adjacent vertices. See documentation on bandwidth in Boost Graph Library for more details. bandwidth the bandwidth of the iven raph Li Lon Boost Graph Library ( ) con <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) coex <- uraph(coex) bandwidth(coex)

5 bellman.ford.sp 5 bellman.ford.sp Bellman-Ford shortest paths usin boost C++ Alorithm for the sinle-source shortest paths problem for a raph with both positive and neative ede weihts. Usae bellman.ford.sp(,start=nodes()[1]) Aruments start instance of class raph character: node name for start of path This function interfaces to the Boost raph library C++ routines for Bellman-Ford shortest paths. Choose the appropriate alorithm to calculate the shortest path carefully based on the properties of the iven raph. See documentation on Bellman-Ford alorithm in Boost Graph Library for more details. A list with elements: all edes minimized true if all edes are minimized, false otherwise. distance penult The vector of distances from start to each node of ; includes Inf when there is no path from start. A vector of indices (in nodes()) of predecessors correspondin to each node on the path from that node back to start. For example, if the element one of this vector has value 10, that means that the predecessor of node 1 is node 10. The next predecessor is found by examinin penult[10]. start The start node that was supplied in the call to bellman.ford.sp. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( )

6 6 betweenness.centrality.clusterin See Also da.sp, dijkstra.sp, johnson.all.pairs.sp, sp.between con <- file(system.file("xml/conn2.xl",packae="rbgl"), open="r") dd <- fromgxl(con) close(con) bellman.ford.sp(dd) bellman.ford.sp(dd,nodes(dd)[2]) betweenness.centrality.clusterin Graph clusterin based on ede betweenness centrality Graph clusterin based on ede betweenness centrality Usae betweenness.centrality.clusterin(, threshold = -1, normalize = TRUE) Aruments threshold normalize an instance of the raph class with edemode undirected threshold to terminate clusterin process boolean, when TRUE, the ede betweenness centrality is scaled by 2/((n-1)(n-2)) where n is the number of vertices in ; when FALSE, the ede betweenness centrality is the absolute value To implement raph clusterin based on ede betweenness centrality. The alorithm is iterative, at each step it computes the ede betweenness centrality and removes the ede with maximum betweenness centrality when it is above the iven threshold. When the maximum betweenness centrality falls below the threshold, the alorithm terminates. See documentation on Clusterin alorithms in Boost Graph Library for details. A list of no.of.edes number of remainin edes after removal edes remainin edes ede.betweenness.centrality betweenness centrality of remainin edes Li Lon <li.lon@isb-sib.ch>

7 bfs 7 Boost Graph Library ( ) See Also brandes.betweenness.centrality con <- file(system.file("xml/conn.xl",packae="rbgl")) coex <- fromgxl(con) close(con) coex <- uraph(coex) betweenness.centrality.clusterin(coex, 0.5, TRUE) bfs Breadth and Depth-first search These functions return information on raph traversal by breadth and depth first search usin routines from the BOOST library. Usae bfs(object, node, checkconn=true) dfs(object, node, checkconn=true) Aruments object node checkconn instance of class raph from Bioconductor raph class node name where search starts; defaults to the node in first position in the node vector. loical for backwards compatibility; this parameter has no effect as of RBGL and will be removed in future versions. These two functions are interfaces to the BOOST raph library functions for breadth first and depth first search. Both methods handle unconnected raphs by applyin the alorithms 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.

8 8 biconncomp For bfs a vector of node indices in order of BFS visit. For dfs a list of two vectors of nodes, with elements discover (order of DFS discovery), and finish (order of DFS completion). VJ Carey <stvjc@channin.harvard.edu> Boost Graph Library ( ) con1 <- file(system.file("xml/bfsex.xl",packae="rbgl"), open="r") dd <- fromgxl(con1) close(con1) bfs(dd, "r") bfs(dd, "s") con2 <- file(system.file("xml/dfsex.xl",packae="rbgl"), open="r") dd2 <- fromgxl(con2) close(con2) dfs(dd2, "u") biconncomp Compute biconnected components for a raph Compute biconnected components for a raph Usae biconncomp() articulationpoints() Aruments an instance of the raph class

9 boyermyrvoldplanaritytest 9 A biconnected raph is a connected raph that remains connected when any one of its vertices, and all the edes incident on this vertex, is removed and the raph remains connected. A biconnected component of a raph is a subraph which is biconnected. An inteer label is assined to each ede to indicate which biconnected component it s in. A vertex in a raph is called an articulation point if removin it increases the number of connected components. See the documentation for the Boost Graph Library for more details. For biconncomp: a vector whose lenth is no. of biconnected components, each entry is a list of nodes that are on the same biconnected components. For articulationpoints: a vector of articulation points in the raph. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) con <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) biconncomp(coex) articulationpoints(coex) boyermyrvoldplanaritytest boyermyrvoldplanaritytest boyermyrvoldplanaritytest description Usae boyermyrvoldplanaritytest() Aruments instance of class raphnel from Bioconductor raph class

10 10 brandes.betweenness.centrality loical, TRUE if test succeeds Li Lon Boost Graph Library ( ) con <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") coex <- fromgxl(con) edemode(coex) = "undirected" boyermyrvoldplanaritytest(coex) # only shows runnability, need better case brandes.betweenness.centrality Compute betweenness centrality for an undirected raph Compute betweenness centrality for an undirected raph Usae brandes.betweenness.centrality() Aruments an instance of the raph class with edemode undirected Brandes.betweenness.centrality computes the betweenness centrality of each vertex or each ede in the raph, usin an alorithm by U. Brandes. Betweenness centrality of a vertex v is calculated as follows: N_st(v) = no. of shortest paths from s to t that pass throuh v, N_st = no. of shortest paths from s to t, betweenness centrality of v = sum(n_st(v)/n_st) for all vertices s!= v!= t. Betweenness centrality of an ede is calculated similarly. The relative betweenness centrality for a vertex is to scale the betweenness centrality of the iven vertex by 2/(n**2-3n + 2) where n is the no. of vertices in the raph. Central point dominance measures the maximum betweenness of any vertex in the raph. See documentation on brandes betweenness centrality in Boost Graph Library for more details.

11 chrobakpaynestraihtlinedrawin 11 A list of betweenness.centrality.vertices betweenness centrality of each vertex betweenness.centrality.edes betweenness centrality of each ede relative.betweenness.centrality.vertices relative betweenness centrality of each vertex dominance maximum betweenness of any point in the raph Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) See Also betweenness.centrality.clusterin con <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) coex <- uraph(coex) brandes.betweenness.centrality(coex) chrobakpaynestraihtlinedrawin chrobakpaynestraihtlinedrawin chrobakpaynestraihtlinedrawin description Usae chrobakpaynestraihtlinedrawin() Aruments instance of class raphnel from Bioconductor raph class

12 12 chrobakpaynestraihtlinedrawin M. Chrobak, T. Payne, A Linear-time Alorithm for Drawin a Planar Graph on the Grid, Information Processin Letters 54: , A matrix with rows x and y, and columns correspondin to raph nodes. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) V <- LETTERS[1:7] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+1], V[2+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+3], V[0+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+4], V[5+1], ) <- addede(v[1+5], V[6+1], ) <- addede(v[1+6], V[3+1], ) <- addede(v[1+0], V[4+1], ) <- addede(v[1+1], V[3+1], ) <- addede(v[1+3], V[5+1], ) <- addede(v[1+2], V[6+1], ) <- addede(v[1+1], V[4+1], ) <- addede(v[1+1], V[5+1], ) <- addede(v[1+1], V[6+1], ) x3 <- chrobakpaynestraihtlinedrawin() x3 plot(t(x3)) el = edel() for (i in seq_len(lenth(nodes()))) sements( rep(x3["x",i], lenth(el[[i]]$edes)), rep(x3["y",i], lenth(el[[i]]$edes)), x3["x", nodes()[el[[i]]$edes]], x3["y", nodes()[el[[i]]$edes]] )

13 clusterincoef 13 clusterincoef Calculate clusterin coefficient for an undirected raph Calculate clusterin coefficient for an undirected raph Usae clusterincoef(, Weihted=FALSE, vw=deree()) Aruments Weihted vw an instance of the raph class calculate weihted clusterin coefficient or not vertex weihts to use when calculatin weihted clusterin coefficient For an undirected raph G, let delta(v) be the number of trianles with v as a node, let tau(v) be the number of triples, i.e., paths of lenth 2 with v as the center node. Let V be the set of nodes with deree at least 2. Define clusterin coefficient for v, c(v) = (delta(v) / tau(v)). Define clusterin coefficient for G, C(G) = sum(c(v)) / V, for all v in V. Define weihted clusterin coefficient for, Cw(G) = sum(w(v) * c(v)) / sum(w(v)), for all v in V. Clusterin coefficient for raph G. Li Lon <li.lon@isb-sib.ch> Approximatin Clusterin Coefficient and Transitivity, T. Schank, D. Waner, Journal of Graph Alorithms and Applications, Vol. 9, No. 2 (2005). See Also clusterincoefappr, transitivity, raphgenerator con <- file(system.file("xml/conn.xl",packae="rbgl")) <- fromgxl(con) close(con) cc <- clusterincoef() ccw1 <- clusterincoef(, Weihted=TRUE) vw <- c(1, 1, 1, 1, 1,1, 1, 1) ccw2 <- clusterincoef(, Weihted=TRUE, vw)

14 14 clusterincoefappr clusterincoefappr Approximate clusterin coefficient for an undirected raph Approximate clusterin coefficient for an undirected raph Usae clusterincoefappr(, k=lenth(nodes()), Weihted=FALSE, vw=deree()) Aruments Weihted vw k an instance of the raph class calculate weihted clusterin coefficient or not vertex weihts to use when calculatin weihted clusterin coefficient parameter controls total expected runtime It is quite expensive to compute cluster coefficient and transitivity exactly for a lare raph by computin the number of trianles in the raph. Instead, clusterincoefappr samples triples with appropriate probability, returns the ratio between the number of existin edes and the number of samples. MORE ABOUT CHOICE OF K. See reference for more details. Approximated clusterin coefficient for raph. Li Lon <li.lon@isb-sib.ch> Approximatin Clusterin Coefficient and Transitivity, T. Schank, D. Waner, Journal of Graph Alorithms and Applications, Vol. 9, No. 2 (2005). See Also clusterincoef, transitivity, raphgenerator

15 connectedcomp 15 con <- file(system.file("xml/conn.xl",packae="rbgl")) <- fromgxl(con) close(con) k = lenth(nodes()) cc <- clusterincoefappr(, k) ccw1 <- clusterincoefappr(, k, Weihted=TRUE) vw <- c(1, 1, 1, 1, 1,1, 1, 1) ccw2 <- clusterincoefappr(, k, Weihted=TRUE, vw) connectedcomp Identify Connected Components in an Undirected Graph Usae The connected components in an undirected raph are identified. If the raph is directed then the weakly connected components are identified. connectedcomp() Aruments raph with edemode undirected Uses a depth first search approach to identifyin all the connected components of an undirected raph. If the input,, is a directed raph it is first transformed to an undirected raph (usin uraph). A list of lenth equal to the number of connected components in. Each element of the list contains a vector of the node labels for the nodes that are connected. Vince Carey <stvjc@channin.harvard.edu> Boost Graph Library ( ) See Also conncomp,stroncomp, uraph, same.component

16 16 da.sp con <- file(system.file("gxl/kmstex.xl",packae="raph"), open="r") km <- fromgxl(con) close(con) km <- raph::addnode(c("f","g","h"), km) km <- addede("g", "H", km, 1) km <- addede("h", "G", km, 1) ukm <- uraph(km) ukm edes(ukm) connectedcomp(ukm) da.sp DAG shortest paths usin boost C++ Alorithm for the sinle-source shortest-paths problem on a weihted, directed acyclic raph (DAG) Usae da.sp(,start=nodes()[1]) Aruments start instance of class raph source node for start of paths These functions are interfaces to the Boost raph library C++ routines for sinle-source shortestpaths on a weihted directed acyclic raph. Choose appropriate shortest-path alorithms carefully based on the properties of the input raph. See documentation in Boost Graph Library for more details. A list with elements: distance penult start The vector of distances from start to each node of ; includes Inf when there is no path from start. A vector of indices (in nodes()) of predecessors correspondin to each node on the path from that node back to start. For example, if the element one of this vector has value 10, that means that the predecessor of node 1 is node 10. The next predecessor is found by examinin penult[10]. The start node that was supplied in the call to da.sp. Li Lon <li.lon@isb-sib.ch>

17 dijkstra.sp 17 Boost Graph Library ( ) See Also bellman.ford.sp, dijkstra.sp, johnson.all.pairs.sp, sp.between con <- file(system.file("xml/conn2.xl",packae="rbgl"), open="r") dd <- fromgxl(con) close(con) da.sp(dd) da.sp(dd,nodes(dd)[2]) dijkstra.sp Dijkstra s shortest paths usin boost C++ dijkstra s shortest paths Usae dijkstra.sp(,start=nodes()[1], ew=unlist(edeweihts())) Aruments start ew instance of class raph character: node name for start of path numeric: ede weihts. These functions are interfaces to the Boost raph library C++ routines for Dijkstra s shortest paths. For some raph subclasses, computin the ede weihts can be expensive. If you are callin dijkstra.sp in a loop, you can pass the ede weihts explicitly to avoid the ede weiht creation cost. A list with elements: distance penult The vector of distances from start to each node of ; includes Inf when there is no path from start. A vector of indices (in nodes()) of predecessors correspondin to each node on the path from that node back to start

18 18 dominatortree. For example, if the element one of this vector has value 10, that means that the predecessor of node 1 is node 10. The next predecessor is found by examinin penult[10]. start The start node that was supplied in the call to dijkstra.sp. VJ Carey <stvjc@channin.harvard.edu> Boost Graph Library ( ) See Also bellman.ford.sp, da.sp, johnson.all.pairs.sp, sp.between con1 <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") dd <- fromgxl(con1) close(con1) dijkstra.sp(dd) dijkstra.sp(dd,nodes(dd)[2]) con2 <- file(system.file("xml/ospf.xl",packae="rbgl"), open="r") ospf <- fromgxl(con2) close(con2) dijkstra.sp(ospf,nodes(ospf)[6]) dominatortree Compute dominator tree from a vertex in a directed raph Compute dominator tree from a vertex in a directed raph Usae dominatortree(, start=nodes()[1]) lenauertarjandominatortree(, start=nodes()[1]) Aruments start a directed raph, one instance of the raph class a vertex in raph

19 edeconnectivity 19 As stated in documentation on Lenauer Tarjan dominator tree in Boost Graph Library: A vertex u dominates a vertex v, if every path of directed raph from the entry to v must o throuh u. This function builds the dominator tree for a directed raph. Output is a vector, ivin each node its immediate dominator. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) con1 <- file(system.file("xml/dominator.xl",packae="rbgl"), open="r") 1 <- fromgxl(con1) close(con1) dominatortree(1) lenauertarjandominatortree(1) edeconnectivity computed ede connectivity and min disconnectin set for an undirected raph computed ede connectivity and min disconnectin set for an undirected raph Usae edeconnectivity() Aruments an instance of the raph class with edemode undirected Consider a raph G consistin of a sinle connected component. The ede connectivity of G is the minimum number of edes in G that can be cut to produce a raph with two (disconnected) components. The set of edes in this cut is called the minimum disconnectin set.

20 20 edmondsmaxcardinalitymatchin A list: connectivity mindisconset the inteer describin the number of edes that must be severed to obtain two components a list (of lenth connectivity) of pairs of node names describin the edes that need to be cut to obtain two components Vince Carey <stvjc@channin.harvard.edu> Boost Graph Library ( ) See Also mincut, edmonds.karp.max.flow, push.relabel.max.flow con <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) edeconnectivity(coex) edmondsmaxcardinalitymatchin edmondsmaxcardinalitymatchin edmondsmaxcardinalitymatchin description Usae edmondsmaxcardinalitymatchin() Aruments instance of class raphnel from Bioconductor raph class a list with two components: a loical named Is max matchin and a character matrix named Matchin with two rows vertex and matched vertex, entries are node labels.

21 edmondsoptimumbranchin 21 Li Lon Boost Graph Library ( ) V <- LETTERS[1:18] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[4+1], ); <- addede(v[1+1], V[5+1], ); <- addede(v[1+2], V[6+1], ); <- addede(v[1+3], V[7+1], ); <- addede(v[1+4], V[5+1], ); <- addede(v[1+6], V[7+1], ); <- addede(v[1+4], V[8+1], ); <- addede(v[1+5], V[9+1], ); <- addede(v[1+6], V[10+1], ); <- addede(v[1+7], V[11+1], ); <- addede(v[1+8], V[9+1], ); <- addede(v[1+10], V[11+1], ); <- addede(v[1+8], V[13+1], ); <- addede(v[1+9], V[14+1], ); <- addede(v[1+10], V[15+1], ); <- addede(v[1+11], V[16+1], ); <- addede(v[1+14], V[15+1], ); x9 <- edmondsmaxcardinalitymatchin() x9 <- addede(v[1+12], V[13+1], ); <- addede(v[1+16], V[17+1], ); x10 <- edmondsmaxcardinalitymatchin() x10 edmondsoptimumbranchin edmondsoptimumbranchin edmondsoptimumbranchin description Usae edmondsoptimumbranchin()

22 22 extractpath Aruments instance of class raphnel from Bioconductor raph class This is an implementation of Edmonds alorithm to find optimum branchin in a directed raph. See references for details. A list with three elements: edelist, weihts, and nodes for the optimum branchin traversal Li Lon <li.lon@isb-sib.ch> See Edmonds Alorithm on V <- LETTERS[1:4] <- new("raphnel", nodes=v, edemode="directed") <- addede(v[1+0],v[1+1],, 3) <- addede(v[1+0],v[2+1],, 1.5) <- addede(v[1+0],v[3+1],, 1.8) <- addede(v[1+1],v[2+1],, 4.3) <- addede(v[1+2],v[3+1],, 2.2) x11 <- edmondsoptimumbranchin() x11 extractpath convert a dijkstra.sp predecessor structure into the path joinin two nodes determine a path between two nodes in a raph, usin output of dijkstra.sp. Usae extractpath(s, f, pens) Aruments s f pens index of startin node in nodes vector of the raph from which pens was derived index of endin node in nodes vector predecessor index vector as returned in the preds component of dijkstra.sp output

23 FileDep 23 numeric vector of indices of nodes alon shortest path Vince Carey Boost Graph Library ( ) See Also allshortestpaths data(filedep) dd <- dijkstra.sp(filedep) extractpath(1,9,dd$pen) FileDep FileDep: a raphnel object representin a file dependency dataset example in boost raph library FileDep: a raphnel object representin a file dependency dataset example in boost raph library Usae data(filedep) an instance of raphnel Boost Graph Library ( )

24 24 floyd.warshall.all.pairs.sp # this is how the raph of data(filedep) was obtained library(raph) fd <- file(system.file("xml/filedep.xl",packae="rbgl"), open="r") show(fromgxl(fd)) if (require(rraphviz)) { data(filedep) plot(filedep) } close(fd) floyd.warshall.all.pairs.sp compute shortest paths for all pairs of nodes compute shortest paths for all pairs of nodes Usae floyd.warshall.all.pairs.sp() Aruments raph object with ede weihts iven Compute shortest paths between every pair of vertices for a dense raph. It works on both undirected and directed raph. The result is iven as a distance matrix. The matrix is symmetric for an undirected raph, and asymmetric (very likely) for a directed raph. For a sparse raph, the johnson.all.pairs.sp functions should be used instead. See documentation on these alorithms in Boost Graph Library for more details. A matrix of shortest path lenths between all pairs of nodes in the raph. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( )

25 profile 25 See Also johnson.all.pairs.sp con <- file(system.file("xml/conn.xl", packae="rbgl"), open="r") coex <- fromgxl(con) close(con) floyd.warshall.all.pairs.sp(coex) profile Compute profile for a raph Compute profile for a raph Usae profile() Aruments an instance of the raph class The profile of a iven raph is the sum of bandwidths for all the vertices in the raph. See documentation on this function in Boost Graph Library for more details. profile the profile of the raph Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) con <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) profile(coex)

26 26 raphgenerator raphgenerator Generate an undirected raph with adjustable clusterin coefficient Generate an undirected raph with adjustable clusterin coefficient Usae raphgenerator(n, d, o) Aruments n d o no. of nodes in the enerated raph parameter for preferential attachment parameter for triple eneration The raph enerator works accordin to the prefential attachment rule. It also enerates raphs with adjustable clusterin coefficient. Parameter d specifies how many preferred edes a new node has. Parameter o limits how many triples to add to a new node. See reference for details. no. of nodes no. of edes edes No. of nodes in the enerated raph No. of edes in the enerated raph Edes in the enerated raph Li Lon <li.lon@isb-sib.ch> Approximatin Clusterin Coefficient and Transitivity, T. Schank, D. Waner, Journal of Graph Alorithms and Applications, Vol. 9, No. 2 (2005). See Also clusterincoef, transitivity, clusterincoefappr n <- 20 d <- 6 o <- 3 <- raphgenerator(n, d, o)

27 hihlyconnsg 27 hihlyconnsg Compute hihly connected subraphs for an undirected raph Compute hihly connected subraphs for an undirected raph Usae hihlyconnsg(, sat=3, ldv=c(3,2,1)) Aruments sat ldv an instance of the raph class with edemode undirected sinleton adoption threshold, positive inteer heuristics to remove lower deree vertice, a decreasin sequence of positive inteer A raph G with n vertices is hihly connected if its connectivity k(g) > n/2. The HCS alorithm partitions a iven raph into a set of hihly connected subraphs, by usin minimum-cut alorithm recursively. To improve performance, the approach is refined by adoptin sinletons, removin low deree vertices and merin clusters. On sinleton adoption: after each round of partition, some hihly connected subraphs could be sinletons (i.e., a subraph contains only one node). To reduce the number of sinletons, therefore reduce number of clusters, we try to et "normal" subraphs to "adopt" them. If a sinleton, s, has n neihbours in a hihly connected subraph c, and n > sat, we add s to c. To adapt to the modified subraphs, this adoption process is repeated until no further such adoption. On lower deree vertices: when the raph has low deree vertices, minimum-cut alorithm will just repeatedly separate these vertices from the rest. To reduce such expensive and non-informative computation, we "remove" these low deree vertices first before applyin minimum-cut alorithm. Given ldv = (d1, d2,..., dp), (d[i] > d[i+1] > 0), we repeat the followin (i from 1 to p): remove all the hihly-connected-subraph found so far; remove vertices with derees < di; find hihlyconnected-subraphs; perform sinleton adoptions. The Boost implementation does not support self-loops, therefore we sinal an error and suest that users remove self-loops usin the function removeselfloops function. This chane does affect deree, but the oriinal article makes no specific reference to self-loops. A list of clusters, each is iven as vertices in the raph. Li Lon <li.lon@isb-sib.ch> A Clusterin Alorithm based on Graph Connectivity by E. Hartuv, R. Shamir, 1999.

28 28 incremental.components See Also edeconnectivity, mincut, removeselfloops con <- file(system.file("xml/hcs.xl",packae="rbgl")) coex <- fromgxl(con) close(con) hihlyconnsg(coex) incremental.components Compute connected components for an undirected raph Usae Compute connected components for an undirected raph init.incremental.components() incremental.components() same.component(, node1, node2) Aruments node1 node2 an instance of the raph class one vertex of the iven raph another vertex of the iven raph This family of functions work toether to calculate the connected components of an undirected raph. The alorithm is based on the disjoint-sets. It works where the raph is rowin by addin new edes. Call "init.incremental.components" to initialize the calculation on a new raph. Call "incremental.components" to re-calculate connected components after rowin the raph. Call "same.component" to learn if two iven vertices are in the same connected components. Currently, the codes can only handle ONE incremental raph at a time. When you start workin on another raph by callin "init.incremental.components", the disjoint-sets info on the previous raph is lost. See documentation on Incremental Connected Components in Boost Graph Library for more details. Output from init.incremental.components is a list of component numbers for each vertex in the raph. Output from incremental.components is a list of component numbers for each vertex in the raph. Output from same.component is true if both nodes are in the same connected component, otherwise it s false.

29 is.trianulated 29 Li Lon Boost Graph Library ( ) See Also conncomp, connectedcomp, stroncomp con <- file(system.file("xml/conn2.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) init.incremental.components(coex) incremental.components(coex) v1 <- 1 v2 <- 5 same.component(coex, v1, v2) is.trianulated Decide if a raph is trianulated Decide if a raph is trianulated Usae is.trianulated() Aruments an instance of the raph class An undirected raph G = (V, E) is trianulated (i.e. chordal) if all cycles [v1, v2,..., vk] of lenth 4 or more have a chord, i.e., an ede [vi, vj] with j!= i +/- 1 (mod k) An equivalent definition of chordal raphs is: G is chordal iff either G is an empty raph, or there is an v in V such that 1. the neihborhood of v (i.e., v and its adjacent nodes) forms a clique, and 2. recursively, G-v is chordal

30 30 iskuratowskisubraph The return value is TRUE if is trianulated and FALSE otherwise. An error is thrown if the raph is not undirected; you miht use uraph to compute the underlyin raph. Li Lon Combinatorial Optimization: alorithms and complexity (p. 403) by C. H. Papadimitriou, K. Steilitz con1 <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con1) close(con1) is.trianulated(coex) con2 <- file(system.file("xml/hcs.xl",packae="rbgl"), open="r") coex <- fromgxl(con2) close(con2) is.trianulated(coex) iskuratowskisubraph iskuratowskisubraph iskuratowskisubraph description Usae iskuratowskisubraph() Aruments instance of class raphnel from Bioconductor raph class a list with three elements: Is planar (loical), Is there a Kuratowski subraph (loical), and a two-row character matrix Edes of Kuratowski subraph with rows from and two and node names as entries. Li Lon <li.lon@isb-sib.ch>

31 isomorphism 31 Boost Graph Library ( ) V <- LETTERS[1:6] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+0], V[2+1], ) <- addede(v[1+0], V[3+1], ) <- addede(v[1+0], V[4+1], ) <- addede(v[1+0], V[5+1], ) <- addede(v[1+1], V[2+1], ) <- addede(v[1+1], V[3+1], ) <- addede(v[1+1], V[4+1], ) <- addede(v[1+1], V[5+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+2], V[4+1], ) <- addede(v[1+2], V[5+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+3], V[5+1], ) <- addede(v[1+4], V[5+1], ) x4 <- iskuratowskisubraph() x4 isomorphism Compute isomorphism from vertices in one raph to those in another raph Compute isomorphism from vertices in one raph to those in another raph Usae isomorphism(1, 2) Aruments 1 2 one instance of the raph class one instance of the raph class

32 32 isstraihtlinedrawin As stated in documentation on isomorphism in Boost Graph Library: An isomorphism is a 1-to- 1 mappin of the vertices in one raph to the vertices of another raph such that adjacency is preserved. Another words, iven raphs G1 = (V1,E1) and G2 = (V2,E2) an isomorphism is a function f such that for all pairs of vertices a,b in V1, ede (a,b) is in E1 if and only if ede (f(a),f(b)) is in E2. Output is true if there exists an isomorphism between 1 and 2, otherwise it s false. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) con1 <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") 1 <- fromgxl(con1) close(con1) con2 <- file(system.file("xml/conn2.xl",packae="rbgl"), open="r") 2 <- fromgxl(con2) close(con2) isomorphism(1, 2) isstraihtlinedrawin isstraihtlinedrawin isstraihtlinedrawin description Usae isstraihtlinedrawin(, drawin) Aruments drawin instance of class raphnel from Bioconductor raph class coordinates of node positions

33 johnson.all.pairs.sp 33 loical, TRUE if drawin is a straiht line layout for Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) V <- LETTERS[1:7] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+1], V[2+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+3], V[0+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+4], V[5+1], ) <- addede(v[1+5], V[6+1], ) <- addede(v[1+6], V[3+1], ) <- addede(v[1+0], V[4+1], ) <- addede(v[1+1], V[3+1], ) <- addede(v[1+3], V[5+1], ) <- addede(v[1+2], V[6+1], ) <- addede(v[1+1], V[4+1], ) <- addede(v[1+1], V[5+1], ) <- addede(v[1+1], V[6+1], ) x3 <- chrobakpaynestraihtlinedrawin() x8 <- isstraihtlinedrawin(, x3) x8 johnson.all.pairs.sp compute shortest path distance matrix for all pairs of nodes compute shortest path distance matrix for all pairs of nodes Usae johnson.all.pairs.sp()

34 34 kcliques Aruments raph object for which edematrix and edeweihts are defined Uses BGL alorithm. matrix of shortest path lenths, read from row node to col node Vince Carey Boost Graph Library ( ) See Also bellman.ford.sp, da.sp, dijkstra.sp, sp.between con <- file(system.file("dot/joh.xl", packae="rbgl"), open="r") z <- fromgxl(con) close(con) johnson.all.pairs.sp(z) kcliques Find all the k-cliques in an undirected raph Find all the k-cliques in an undirected raph Usae kcliques() Aruments an instance of the raph class

35 kcores 35 Notice that there are different definitions of k-clique in different context. In computer science, a k-clique of a raph is a clique, i.e., a complete subraph, of k nodes. In Social Network Analysis, a k-clique in a raph is a subraph where the distance between any two nodes is no reater 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. Alorithm is outlined as followin: (1) use Johnson s alorithm to fill D; let N = max(d[i][j]) for all i, j; (2) each ede 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 followin: if for all nodes j in KC, D[v][j] <= k, add node v to KC; (3.3) eliminate duplicates; (4) the whole raph is N-clique. A list of lenth N; k-th entry (k = 1,..., N) is a list of all the k-cliques in raph. Li Lon <li.lon@isb-sib.ch> Social Network Analysis: Methods and Applications. By S. Wasserman and K. Faust, pp con <- file(system.file("xml/snacliqueex.xl",packae="rbgl")) coex <- fromgxl(con) close(con) kcliques(coex) kcores Find all the k-cores in a raph Find all the k-cores in a raph Usae kcores(, EdeType=c("in", "out")) Aruments EdeType an instance of the raph class what types of edes to be considered when is directed

36 36 lambdasets A k-core in a raph is a subraph where each node is adjacent to at least a minimum number, k, of the other nodes in the subraph. A k-core in a raph may not be connected. The core number for each node is the hihest 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 alorithm by V. Bataelj and M. Zaversnik, The example snacoreex.xl is in the paper by V. Bataelj and M. Zaversnik, A vector of the core numbers for all the nodes in. Li Lon <li.lon@isb-sib.ch> Social Network Analysis: Methods and Applications. By S. Wasserman and K. Faust, pp An O(m) Alorithm for Cores decomposition of networks, by V. Bataelj and M. Zaversnik, con1 <- file(system.file("xml/snacoreex.xl",packae="rbgl")) kcoex <- fromgxl(con1) close(con1) kcores(kcoex) con2 <- file(system.file("xml/conn2.xl",packae="rbgl")) kcoex2 <- fromgxl(con2) close(con2) kcores(kcoex2) kcores(kcoex2, "in") kcores(kcoex2, "out") lambdasets Find all the lambda-sets in an undirected raph Find all the lambda-sets in an undirected raph Usae lambdasets()

37 layout 37 Aruments an instance of the raph class From reference (1), p. 270: A set of nodes is a lambda-set if any pair of nodes in the lambda set has larer ede connectivity than any pair of nodes consistin 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 ede-independent paths connectin them to each other than to outsiders. A lambda set could be characterized by the minimum ede connectivity k amon its members, and could be called lambda-k sets. Let N be maximum ede connectivity of raph, we output all the lambda-k set for all k = 1,..., N. Maximum ede connectivity, N, of the raph, and A list of lenth N; k-th entry (k = 1,..., N) is a list of all the lambda-k sets in raph. Li Lon <li.lon@isb-sib.ch> (1) Social Network Analysis: Methods and Applications. By S. Wasserman and K. Faust, pp (2) LS sets, lambda sets and other cohesive subsets. By S. P. Boratti, M. G. Everett, P. R. Shirey, Social Networks 12 (1990) p con <- file(system.file("xml/snalambdaex.xl",packae="rbgl")) coex <- fromgxl(con) close(con) lambdasets(coex) layout Layout an undirected raph in 2D suspended june Layout an undirected raph in 2D suspended june Usae circlelayout(, radius=1) # does not compile with boost 1.49 kamadakawaisprinlayout(, ede_or_side=1, es_lenth=1 ) fruchtermanreinoldforcedirectedlayout(, width=1, heiht=1) randomgraphlayout(, minx=0, maxx=1, miny=0, maxy=1)

38 38 layout Aruments radius ede_or_side es_lenth width heiht minx maxx miny maxy an instance of the raph class with edemode undirected radius of a reular n-polyon boolean indicatin the lenth is for an ede or for a side, default is for an ede the lenth of an ede or a side for layout the width of the dislay area, all x coordinates fall in [-width/2, width/2] the heiht of the display area, all y coordinates fall in [-heiht/2, heiht/2] minimum x coordinate maximum x coordinate minimum y coordinate maximum y coordinate If you want to simply draw a raph, you should consider usin packae Rraphviz. The layout options in packae Rraphviz: neato, circo and fdp, correspond to kamadakawaisprinlayout, circlelayout and fruchtermanreinoldforcedirectedlayout, respectively. Function circlelayout layouts the raph with the vertices at the points of a reular n-polyon. The distance from the center of the polyon to each point is determined by the radius parameter. Function kamadakawaisprinlayout provides Kamada-Kawai sprin layout for connected, undirected raphs. User provides either the unit lenth e of an ede in the layout or the lenth of a side s of the display area. Function randomgraphlayout places the points of the raph at random locations. Function fruchtermanreinoldforcedirectedlayout performs layout of unweihted, undirected raphs. It s a force-directed alorithm. The BGL implementation doesn t handle disconnected raphs very well, since it doesn t explicitly ive each connected component a reion proportional to its size. See documentation on this function in Boost Graph Library for more details. A (2 x n) matrix, where n is the number of nodes in the raph, each column ives the (x, y)- coordinates for the correspondin node. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) See Also layoutgraph

39 makebiconnectedplanar 39 ## Not run: con <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) coex <- uraph(coex) circlelayout(coex) kamadakawaisprinlayout(coex) randomgraphlayout(coex) fruchtermanreinoldforcedirectedlayout(coex, 10, 10) ## End(Not run) makebiconnectedplanar makebiconnectedplanar makebiconnectedplanar description Usae makebiconnectedplanar() Aruments instance of class raphnel from Bioconductor raph class From An undirected raph is connected if, for any two vertices u and v, there s a path from u to v. An undirected raph is biconnected if it is connected and it remains connected even if any sinle vertex is removed. Finally, a planar raph is maximal planar (also called trianulated) if no additional ede (with the exception of self-loops and parallel edes) can be added to it without creatin a nonplanar raph. Any maximal planar simple raph on n > 2 vertices has exactly 3n - 6 edes and 2n - 4 faces, a consequence of Euler s formula. If a planar raph isn t connected, isn t biconnected, or isn t maximal planar, there is some set of edes that can be added to the raph to make it satisfy any of those three properties while preservin planarity. Many planar raph drawin alorithms make at least one of these three assumptions about the input raph, so there are functions in the Boost Graph Library that can help: make_connected adds a minimal set of edes to an undirected raph to make it connected. make_biconnected_planar adds a set of edes to a connected, undirected planar raph to make it biconnected while preservin planarity.

40 40 makeconnected make_maximal_planar adds a set of edes to a biconnected, undirected planar raph to make it maximal planar. The function documented here implements the second approach. A list with two elements: Is planar is a loical indicatin achievement of planarity, and new raph, a raphnel instance that is biconnected and planar. Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) V <- LETTERS[1:11] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+3], V[0+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+4], V[5+1], ) <- addede(v[1+5], V[3+1], ) <- addede(v[1+5], V[6+1], ) <- addede(v[1+6], V[7+1], ) <- addede(v[1+7], V[8+1], ) <- addede(v[1+8], V[5+1], ) <- addede(v[1+8], V[9+1], ) <- addede(v[1+0], V[10+1], ) x6 <- makebiconnectedplanar() x6 makeconnected makeconnected makeconnected description Usae makeconnected()

41 makemaximalplanar 41 Aruments instance of class raphnel from Bioconductor raph class a raphnel instance with a minimal set of edes added to achieve connectedness. an instance of raphnel Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) V <- LETTERS[1:11] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+5], V[6+1], ) <- addede(v[1+6], V[7+1], ) <- addede(v[1+8], V[9+1], ) <- addede(v[1+9], V[10+1], ) <- addede(v[1+10], V[8+1], ) x5 <- makeconnected() x5 makemaximalplanar makemaximalplanar makemaximalplanar description Usae makemaximalplanar()

42 42 max.flow Aruments instance of class raphnel from Bioconductor raph class see a list with two elements, Is planar:, a loical indicatin state of raph, and new raph, a raph- NEL instance Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) V <- LETTERS[1:10] <- new("raphnel", nodes=v, edemode="undirected") <- addede(v[1+0], V[1+1], ) <- addede(v[1+1], V[2+1], ) <- addede(v[1+2], V[3+1], ) <- addede(v[1+3], V[4+1], ) <- addede(v[1+4], V[5+1], ) <- addede(v[1+5], V[6+1], ) <- addede(v[1+6], V[7+1], ) <- addede(v[1+7], V[8+1], ) <- addede(v[1+8], V[9+1], ) x7 <- makemaximalplanar() x7 max.flow Compute max flow for a directed raph Compute max flow for a directed raph

43 max.flow 43 Usae edmonds.karp.max.flow(, source, sink) push.relabel.max.flow(, source, sink) kolmoorov.max.flow(, source, sink) Aruments source sink an instance of the raph class with edemode directed node name (character) or node number (int) for the source of the flow node name (character) or node number (int) for the sink of the flow Given a directed raph G=(V, E) of a sinle connected component with a vertex source and a vertex sink. Each arc has a positive real valued capacity, currently it s equivalent to the weiht of the arc. The flow of the network is the net flow enterin the vertex sink. The maximum flow problem is to determine the maximum possible value for the flow to the sink and the correspondin flow values for each arc. See documentation on these alorithms in Boost Graph Library for more details. A list of maxflow edes flows the max flow from source to sink the nodes of the arcs with non-zero capacities the flow values of the arcs with non-zero capacities Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) See Also mincut, edeconnectivity con <- file(system.file("xml/dijkex.xl",packae="rbgl"), open="r") <- fromgxl(con) close(con) ans1 <- edmonds.karp.max.flow(, "B", "D") ans2 <- edmonds.karp.max.flow(, 3, 2) ans3 <- push.relabel.max.flow(, 2, 4) # 3 and 2 equivalent to "C" and "B" # 2 and 4 equivalent to "B" and "D"

44 44 maxclique ans4 <- push.relabel.max.flow(, "C", "B") # error in the followin now, 14 june 2014 #ans5 <- kolmoorov.max.flow(, "B", "D") #ans6 <- kolmoorov.max.flow(, 3, 2) maxclique Find all the cliques in a raph Find all the cliques in a raph Usae maxclique(, nodes=null, edemat=null) Aruments nodes edemat an instance of the raph class vector of node names, to be supplied if is not 2 x p matrix with indices of edes in nodes, one-based, only to be supplied if code is not Notice the maximum clique problem is NP-complete, which means it cannot be solved by any known polynomial alorithm. We implemented the alorithm by C. Bron and J. Kerbosch, It is an error to supply both and either of the other aruments. If is not supplied, no checkin of the consistency of nodes and edemat is performed. maxclique list of all cliques in Li Lon <li.lon@isb-sib.ch> Findin all cliques of an undirected raph, by C. Bron and J. Kerbosch, Communication of ACM, Sept 1973, Vol 16, No. 9.

45 maximumcycleratio 45 con1 <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con1) close(con1) maxclique(coex) con2 <- file(system.file("xml/hcs.xl",packae="rbgl"), open="r") coex <- fromgxl(con2) close(con2) maxclique(coex) maximumcycleratio maximumcycleratio maximumcycleratio description Usae maximumcycleratio() Aruments instance of class raphnel from Bioconductor raph class NOT IMPLEMENTED A list with messae indicatin not implemented Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( )

46 46 mincut mincut Compute min-cut for an undirected raph Compute min-cut for an undirected raph Usae mincut() Aruments an instance of the raph class with edemode undirected Given an undirected raph G=(V, E) of a sinle 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 edes 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. A list of mincut S V-S the number of edes to be severed to obtain the minimum cut the smaller subset of vertices in the minimum cut the other subset of vertices in the minimum cut Li Lon <li.lon@isb-sib.ch> Boost Graph Library ( ) See Also edeconnectivity con <- file(system.file("xml/conn.xl",packae="rbgl"), open="r") coex <- fromgxl(con) close(con) mincut(coex)

RBGL: R interface to boost graph library

RBGL: R interface to boost graph library RBGL: R interface to boost graph library L. Long, VJ Carey, and R. Gentleman November 19, 2018 Summary. The RBGL package is primarily an interface from R to the Boost Graph Library (BGL). It includes some

More information

The minimum cut algorithm of. Stoer and Wagner. Kurt Mehlhorn and Christian Uhrig. June 27, 1995

The minimum cut algorithm of. Stoer and Wagner. Kurt Mehlhorn and Christian Uhrig. June 27, 1995 The minimum cut alorithm of Stoer and Waner Kurt Mehlhorn and Christian Uhri June 27, 1995 1. Min-cuts in undirected raphs. Let G = (V ; E) be an undirected raph (self-loops and parallel edes are allowed)

More information

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3?

Problem 1. Which of the following is true of functions =100 +log and = + log? Problem 2. Which of the following is true of functions = 2 and =3? Multiple-choice Problems: Problem 1. Which of the following is true of functions =100+log and =+log? a) = b) =Ω c) =Θ d) All of the above e) None of the above Problem 2. Which of the following is true

More information

Index. stack-based, 400 A* algorithm, 325

Index. stack-based, 400 A* algorithm, 325 Index Abstract transitive closure, 174-175, 217-221 Active vertex, 411 Acyclic graph. See Digraph; Directed acyclic graph (DAG) Acyclic network, 313-321, 334-335 maxflow, 427-429 Adjacency-lists representation,

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Konigsberg Bridge Problem

Konigsberg Bridge Problem Graphs Konigsberg Bridge Problem c C d g A Kneiphof e D a B b f c A C d e g D a b f B Euler s Graph Degree of a vertex: the number of edges incident to it Euler showed that there is a walk starting at

More information

Clustering Using Graph Connectivity

Clustering Using Graph Connectivity Clustering Using Graph Connectivity Patrick Williams June 3, 010 1 Introduction It is often desirable to group elements of a set into disjoint subsets, based on the similarity between the elements in the

More information

Basic Graph Definitions

Basic Graph Definitions CMSC 341 Graphs Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices, V, and a finite set of edges, E. Each edge is a pair (v,w) where v, w V. V and E are sets, so each vertex

More information

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico.

Graph Algorithms. Parallel and Distributed Computing. Department of Computer Science and Engineering (DEI) Instituto Superior Técnico. Graph Algorithms Parallel and Distributed Computing Department of Computer Science and Engineering (DEI) Instituto Superior Técnico May, 0 CPD (DEI / IST) Parallel and Distributed Computing 0-0-0 / Outline

More information

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1

Undirected Graphs. DSA - lecture 6 - T.U.Cluj-Napoca - M. Joldos 1 Undirected Graphs Terminology. Free Trees. Representations. Minimum Spanning Trees (algorithms: Prim, Kruskal). Graph Traversals (dfs, bfs). Articulation points & Biconnected Components. Graph Matching

More information

Mining Social Network Graphs

Mining Social Network Graphs Mining Social Network Graphs Analysis of Large Graphs: Community Detection Rafael Ferreira da Silva rafsilva@isi.edu http://rafaelsilva.com Note to other teachers and users of these slides: We would be

More information

UNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list

UNIT Name the different ways of representing a graph? a.adjacencymatrix b. Adjacency list UNIT-4 Graph: Terminology, Representation, Traversals Applications - spanning trees, shortest path and Transitive closure, Topological sort. Sets: Representation - Operations on sets Applications. 1. Name

More information

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies:

UNIT 5 GRAPH. Application of Graph Structure in real world:- Graph Terminologies: UNIT 5 CSE 103 - Unit V- Graph GRAPH Graph is another important non-linear data structure. In tree Structure, there is a hierarchical relationship between, parent and children that is one-to-many relationship.

More information

GRAPHS (Undirected) Graph: Set of objects with pairwise connections. Why study graph algorithms?

GRAPHS (Undirected) Graph: Set of objects with pairwise connections. Why study graph algorithms? GRAPHS (Undirected) Graph: Set of objects with pairwise connections. Why study graph algorithms? Interesting and broadly useful abstraction. Challenging branch of computer science and discrete math. Hundreds

More information

Algorithm Design (8) Graph Algorithms 1/2

Algorithm Design (8) Graph Algorithms 1/2 Graph Algorithm Design (8) Graph Algorithms / Graph:, : A finite set of vertices (or nodes) : A finite set of edges (or arcs or branches) each of which connect two vertices Takashi Chikayama School of

More information

Graph. Vertex. edge. Directed Graph. Undirected Graph

Graph. Vertex. edge. Directed Graph. Undirected Graph Module : Graphs Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS E-mail: natarajan.meghanathan@jsums.edu Graph Graph is a data structure that is a collection

More information

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity.

2. True or false: even though BFS and DFS have the same space complexity, they do not always have the same worst case asymptotic time complexity. 1. T F: Consider a directed graph G = (V, E) and a vertex s V. Suppose that for all v V, there exists a directed path in G from s to v. Suppose that a DFS is run on G, starting from s. Then, true or false:

More information

Undirected Graphs. Hwansoo Han

Undirected Graphs. Hwansoo Han Undirected Graphs Hwansoo Han Definitions Undirected graph (simply graph) G = (V, E) V : set of vertexes (vertices, nodes, points) E : set of edges (lines) An edge is an unordered pair Edge (v, w) = (w,

More information

Graphs & Digraphs Tuesday, November 06, 2007

Graphs & Digraphs Tuesday, November 06, 2007 Graphs & Digraphs Tuesday, November 06, 2007 10:34 PM 16.1 Directed Graphs (digraphs) like a tree but w/ no root node & no guarantee of paths between nodes consists of: nodes/vertices - a set of elements

More information

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs

CS 311 Discrete Math for Computer Science Dr. William C. Bulko. Graphs CS 311 Discrete Math for Computer Science Dr. William C. Bulko Graphs 2014 Definitions Definition: A graph G = (V,E) consists of a nonempty set V of vertices (or nodes) and a set E of edges. Each edge

More information

WAVELENGTH Division Multiplexing (WDM) significantly

WAVELENGTH Division Multiplexing (WDM) significantly IEEE JOURNAL ON SELECTED AREAS IN COMMUNICATIONS, VOL. 25, NO. 6, AUGUST 27 1 Groomin Multicast Traffic in Unidirectional SONET/WDM Rins Anuj Rawat, Richard La, Steven Marcus, and Mark Shayman Abstract

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 3 Definitions an undirected graph G = (V, E)

More information

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions

11/22/2016. Chapter 9 Graph Algorithms. Introduction. Definitions. Definitions. Definitions. Definitions Introduction Chapter 9 Graph Algorithms graph theory useful in practice represent many real-life problems can be slow if not careful with data structures 2 Definitions an undirected graph G = (V, E) is

More information

CS 125 Section #5 Graph Traversal and Linear Programs October 6, 2016

CS 125 Section #5 Graph Traversal and Linear Programs October 6, 2016 CS 125 Section #5 Graph Traversal and Linear Programs October 6, 2016 1 Depth first search 1.1 The Algorithm Besides breadth first search, which we saw in class in relation to Dijkstra s algorithm, there

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

Lecture Note: Computation problems in social. network analysis

Lecture Note: Computation problems in social. network analysis Lecture Note: Computation problems in social network analysis Bang Ye Wu CSIE, Chung Cheng University, Taiwan September 29, 2008 In this lecture note, several computational problems are listed, including

More information

Grooming Multicast Traffic in Unidirectional SONET/WDM Rings

Grooming Multicast Traffic in Unidirectional SONET/WDM Rings 1 Groomin Multicast Traffic in Unidirectional SONET/WDM Rins Anuj Rawat, Richard La, Steven Marcus and Mark Shayman Abstract In this paper we study the problem of efficient roomin of iven non-uniform multicast

More information

Edgebreaker: Connectivity compression for triangle meshes Jarek Rossignac GVU Center, Georgia Institute of Technology

Edgebreaker: Connectivity compression for triangle meshes Jarek Rossignac GVU Center, Georgia Institute of Technology 1999 IEEE. Reprinted, with permission from IEEE Transactions onvisualization and Computer Graphics, Vol. 5, No. 1, 1999 Edebreaker: Connectivity compression for trianle meshes Jarek Rossinac GVU Center,

More information

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3 Multidimensional Arrays & Graphs CMSC 420: Lecture 3 Mini-Review Abstract Data Types: List Stack Queue Deque Dictionary Set Implementations: Linked Lists Circularly linked lists Doubly linked lists XOR

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo

More information

General Design of Grid-based Data Replication. Schemes Using Graphs and a Few Rules. availability of read and write operations they oer and

General Design of Grid-based Data Replication. Schemes Using Graphs and a Few Rules. availability of read and write operations they oer and General esin of Grid-based ata Replication Schemes Usin Graphs and a Few Rules Oliver Theel University of California epartment of Computer Science Riverside, C 92521-0304, US bstract Grid-based data replication

More information

Treewidth and graph minors

Treewidth and graph minors Treewidth and graph minors Lectures 9 and 10, December 29, 2011, January 5, 2012 We shall touch upon the theory of Graph Minors by Robertson and Seymour. This theory gives a very general condition under

More information

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 1 Depth first search 1.1 The Algorithm Besides breadth first search, which we saw in class in relation to Dijkstra s algorithm, there is one

More information

Graph and Digraph Glossary

Graph and Digraph Glossary 1 of 15 31.1.2004 14:45 Graph and Digraph Glossary A B C D E F G H I-J K L M N O P-Q R S T U V W-Z Acyclic Graph A graph is acyclic if it contains no cycles. Adjacency Matrix A 0-1 square matrix whose

More information

CSI 604 Elementary Graph Algorithms

CSI 604 Elementary Graph Algorithms CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the

More information

IN this paper, we establish the computational complexity of optimally solving multi-robot path planning problems

IN this paper, we establish the computational complexity of optimally solving multi-robot path planning problems Intractability of Optimal Multi-Robot Path Plannin on Planar Graphs Jinjin Yu Abstract arxiv:504.007v3 [cs.ro] 6 Dec 05 We study the computational complexity of optimally solvin multi-robot path plannin

More information

Algorithms: Lecture 10. Chalmers University of Technology

Algorithms: Lecture 10. Chalmers University of Technology Algorithms: Lecture 10 Chalmers University of Technology Today s Topics Basic Definitions Path, Cycle, Tree, Connectivity, etc. Graph Traversal Depth First Search Breadth First Search Testing Bipartatiness

More information

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F))

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F)) DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING EC6301 OBJECT ORIENTED PROGRAMMING AND DATA STRUCTURES UNIT IV NONLINEAR DATA STRUCTURES Part A 1. Define Tree [N/D 08]

More information

COMP 251 Winter 2017 Online quizzes with answers

COMP 251 Winter 2017 Online quizzes with answers COMP 251 Winter 2017 Online quizzes with answers Open Addressing (2) Which of the following assertions are true about open address tables? A. You cannot store more records than the total number of slots

More information

Graph Algorithms Using Depth First Search

Graph Algorithms Using Depth First Search Graph Algorithms Using Depth First Search Analysis of Algorithms Week 8, Lecture 1 Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Graph Algorithms Using Depth

More information

main Entry main main pow Entry pow pow

main Entry main main pow Entry pow pow Interprocedural Path Prolin David Melski and Thomas Reps Computer Sciences Department, University of Wisconsin, 20 West Dayton Street, Madison, WI, 53706, USA, fmelski, reps@cs.wisc.edu Abstract. In path

More information

Chapter 5 THE MODULE FOR DETERMINING AN OBJECT S TRUE GRAY LEVELS

Chapter 5 THE MODULE FOR DETERMINING AN OBJECT S TRUE GRAY LEVELS Qian u Chapter 5. Determinin an Object s True Gray evels 3 Chapter 5 THE MODUE OR DETERMNNG AN OJECT S TRUE GRAY EVES This chapter discusses the module for determinin an object s true ray levels. To compute

More information

1 Theory 1 (CSc 473): Automata, Grammars, and Lanuaes For any strin w = w 1 w 2 :::w n, define w R to be the reversal of w: w R = w n w n 1 :::w 1. Su

1 Theory 1 (CSc 473): Automata, Grammars, and Lanuaes For any strin w = w 1 w 2 :::w n, define w R to be the reversal of w: w R = w n w n 1 :::w 1. Su Masters Examination Department of Computer Science March 27, 1999 Instructions This examination consists of nine problems. The questions are in three areas: 1. Theory and Alorithms: CSc 473, 545, and 573;

More information

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies

Outline. Introduction. Representations of Graphs Graph Traversals. Applications. Definitions and Basic Terminologies Graph Chapter 9 Outline Introduction Definitions and Basic Terminologies Representations of Graphs Graph Traversals Breadth first traversal Depth first traversal Applications Single source shortest path

More information

Jörgen Bang-Jensen and Gregory Gutin. Digraphs. Theory, Algorithms and Applications. Springer

Jörgen Bang-Jensen and Gregory Gutin. Digraphs. Theory, Algorithms and Applications. Springer Jörgen Bang-Jensen and Gregory Gutin Digraphs Theory, Algorithms and Applications Springer Contents 1. Basic Terminology, Notation and Results 1 1.1 Sets, Subsets, Matrices and Vectors 1 1.2 Digraphs,

More information

Reference Sheet for CO142.2 Discrete Mathematics II

Reference Sheet for CO142.2 Discrete Mathematics II Reference Sheet for CO14. Discrete Mathematics II Spring 017 1 Graphs Defintions 1. Graph: set of N nodes and A arcs such that each a A is associated with an unordered pair of nodes.. Simple graph: no

More information

W4231: Analysis of Algorithms

W4231: Analysis of Algorithms W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally

More information

CS 4407 Algorithms Lecture 5: Graphs an Introduction

CS 4407 Algorithms Lecture 5: Graphs an Introduction CS 4407 Algorithms Lecture 5: Graphs an Introduction Prof. Gregory Provan Department of Computer Science University College Cork 1 Outline Motivation Importance of graphs for algorithm design applications

More information

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs

Lecture 10,11: General Matching Polytope, Maximum Flow. 1 Perfect Matching and Matching Polytope on General Graphs CMPUT 675: Topics in Algorithms and Combinatorial Optimization (Fall 2009) Lecture 10,11: General Matching Polytope, Maximum Flow Lecturer: Mohammad R Salavatipour Date: Oct 6 and 8, 2009 Scriber: Mohammad

More information

Polygonal Approximation of Closed Curves across Multiple Views

Polygonal Approximation of Closed Curves across Multiple Views Polyonal Approximation of Closed Curves across Multiple Views M. Pawan Kumar Saurah oyal C. V. Jawahar P. J. Narayanan Centre for Visual Information echnoloy International Institute of Information echnoloy

More information

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS

GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS GRAPHS, GRAPH MODELS, GRAPH TERMINOLOGY, AND SPECIAL TYPES OF GRAPHS DR. ANDREW SCHWARTZ, PH.D. 10.1 Graphs and Graph Models (1) A graph G = (V, E) consists of V, a nonempty set of vertices (or nodes)

More information

Elements of Graph Theory

Elements of Graph Theory Elements of Graph Theory Quick review of Chapters 9.1 9.5, 9.7 (studied in Mt1348/2008) = all basic concepts must be known New topics we will mostly skip shortest paths (Chapter 9.6), as that was covered

More information

Community Detection. Community

Community Detection. Community Community Detection Community In social sciences: Community is formed by individuals such that those within a group interact with each other more frequently than with those outside the group a.k.a. group,

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

Lesson 2 7 Graph Partitioning

Lesson 2 7 Graph Partitioning Lesson 2 7 Graph Partitioning The Graph Partitioning Problem Look at the problem from a different angle: Let s multiply a sparse matrix A by a vector X. Recall the duality between matrices and graphs:

More information

UNIT III TREES. A tree is a non-linear data structure that is used to represents hierarchical relationships between individual data items.

UNIT III TREES. A tree is a non-linear data structure that is used to represents hierarchical relationships between individual data items. UNIT III TREES A tree is a non-linear data structure that is used to represents hierarchical relationships between individual data items. Tree: A tree is a finite set of one or more nodes such that, there

More information

CS6301 Programming and Data Structures II Unit -5 REPRESENTATION OF GRAPHS Graph and its representations Graph is a data structure that consists of following two components: 1. A finite set of vertices

More information

Vertical decomposition of a lattice using clique separators

Vertical decomposition of a lattice using clique separators Vertical decomposition of a lattice using clique separators Anne Berry, Romain Pogorelcnik, Alain Sigayret LIMOS UMR CNRS 6158 Ensemble Scientifique des Cézeaux Université Blaise Pascal, F-63 173 Aubière,

More information

Graph Algorithms. Definition

Graph Algorithms. Definition Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of

More information

Edgebreaker: Connectivity compression for triangle meshes

Edgebreaker: Connectivity compression for triangle meshes J. Rossinac GVU Technical Report GIT-GVU-98-35 (revised version of GIT-GVU-98-7) pae Edebreaker: Connectivity compression for trianle meshes Jarek Rossinac GVU Center, Georia Institute of Technoloy Abstract

More information

22 Elementary Graph Algorithms. There are two standard ways to represent a

22 Elementary Graph Algorithms. There are two standard ways to represent a VI Graph Algorithms Elementary Graph Algorithms Minimum Spanning Trees Single-Source Shortest Paths All-Pairs Shortest Paths 22 Elementary Graph Algorithms There are two standard ways to represent a graph

More information

Introduction to Graph Theory

Introduction to Graph Theory Introduction to Graph Theory Tandy Warnow January 20, 2017 Graphs Tandy Warnow Graphs A graph G = (V, E) is an object that contains a vertex set V and an edge set E. We also write V (G) to denote the vertex

More information

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1

CS200: Graphs. Prichard Ch. 14 Rosen Ch. 10. CS200 - Graphs 1 CS200: Graphs Prichard Ch. 14 Rosen Ch. 10 CS200 - Graphs 1 Graphs A collection of nodes and edges What can this represent? n A computer network n Abstraction of a map n Social network CS200 - Graphs 2

More information

COT 6405 Introduction to Theory of Algorithms

COT 6405 Introduction to Theory of Algorithms COT 6405 Introduction to Theory of Algorithms Topic 14. Graph Algorithms 11/7/2016 1 Elementary Graph Algorithms How to represent a graph? Adjacency lists Adjacency matrix How to search a graph? Breadth-first

More information

Varying Applications (examples)

Varying Applications (examples) Graph Theory Varying Applications (examples) Computer networks Distinguish between two chemical compounds with the same molecular formula but different structures Solve shortest path problems between cities

More information

CS/COE 1501 cs.pitt.edu/~bill/1501/ Graphs

CS/COE 1501 cs.pitt.edu/~bill/1501/ Graphs CS/COE 1501 cs.pitt.edu/~bill/1501/ Graphs 5 3 2 4 1 0 2 Graphs A graph G = (V, E) Where V is a set of vertices E is a set of edges connecting vertex pairs Example: V = {0, 1, 2, 3, 4, 5} E = {(0, 1),

More information

Algorithms and Data Structures

Algorithms and Data Structures Algorithms and Data Structures Graphs: Introduction Ulf Leser This Course Introduction 2 Abstract Data Types 1 Complexity analysis 1 Styles of algorithms 1 Lists, stacks, queues 2 Sorting (lists) 3 Searching

More information

CS/COE

CS/COE CS/COE 151 www.cs.pitt.edu/~lipschultz/cs151/ Graphs 5 3 2 4 1 Graphs A graph G = (V, E) Where V is a set of vertices E is a set of edges connecting vertex pairs Example: V = {, 1, 2, 3, 4, 5} E = {(,

More information

Graphs, graph algorithms (for image segmentation),... in progress

Graphs, graph algorithms (for image segmentation),... in progress Graphs, graph algorithms (for image segmentation),... in progress Václav Hlaváč Czech Technical University in Prague Czech Institute of Informatics, Robotics and Cybernetics 66 36 Prague 6, Jugoslávských

More information

Introduction to Graphs. CS2110, Spring 2011 Cornell University

Introduction to Graphs. CS2110, Spring 2011 Cornell University Introduction to Graphs CS2110, Spring 2011 Cornell University A graph is a data structure for representing relationships. Each graph is a set of nodes connected by edges. Synonym Graph Hostile Slick Icy

More information

Homework Assignment #3 Graph

Homework Assignment #3 Graph CISC 4080 Computer Algorithms Spring, 2019 Homework Assignment #3 Graph Some of the problems are adapted from problems in the book Introduction to Algorithms by Cormen, Leiserson and Rivest, and some are

More information

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS

CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS 1 UNIT I INTRODUCTION CS6702 GRAPH THEORY AND APPLICATIONS 2 MARKS QUESTIONS AND ANSWERS 1. Define Graph. A graph G = (V, E) consists

More information

Minimum-Cost Multicast Routing for Multi-Layered Multimedia Distribution

Minimum-Cost Multicast Routing for Multi-Layered Multimedia Distribution Minimum-Cost Multicast Routin for Multi-Layered Multimedia Distribution Hsu-Chen Chen and Frank Yeon-Sun Lin Department of Information Manaement, National Taiwan University 50, Lane 144, Keelun Rd., Sec.4,

More information

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered

More information

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions

Dr. Amotz Bar-Noy s Compendium of Algorithms Problems. Problems, Hints, and Solutions Dr. Amotz Bar-Noy s Compendium of Algorithms Problems Problems, Hints, and Solutions Chapter 1 Searching and Sorting Problems 1 1.1 Array with One Missing 1.1.1 Problem Let A = A[1],..., A[n] be an array

More information

Outline. Graphs. Divide and Conquer.

Outline. Graphs. Divide and Conquer. GRAPHS COMP 321 McGill University These slides are mainly compiled from the following resources. - Professor Jaehyun Park slides CS 97SI - Top-coder tutorials. - Programming Challenges books. Outline Graphs.

More information

Lecture 6: Shortest distance, Eulerian cycles, Maxflow

Lecture 6: Shortest distance, Eulerian cycles, Maxflow DD2458, Problem Solving and Programming Under Pressure Lecture 6: Shortest distance, Eulerian cycles, Maxflow Date: 2008-10-06 Scribe(s): Adam Kull, David Vuorio Lecturer: Douglas Wikström 1 Shortest path

More information

Introduction to. Graph Theory. Second Edition. Douglas B. West. University of Illinois Urbana. ftentice iiilil PRENTICE HALL

Introduction to. Graph Theory. Second Edition. Douglas B. West. University of Illinois Urbana. ftentice iiilil PRENTICE HALL Introduction to Graph Theory Second Edition Douglas B. West University of Illinois Urbana ftentice iiilil PRENTICE HALL Upper Saddle River, NJ 07458 Contents Preface xi Chapter 1 Fundamental Concepts 1

More information

Reducing Network Cost of Many-to-Many Communication in Unidirectional WDM Rings with Network Coding

Reducing Network Cost of Many-to-Many Communication in Unidirectional WDM Rings with Network Coding 1 Reducin Network Cost of Many-to-Many Communication in Unidirectional WDM Rins with Network Codin Lon Lon and Ahmed E. Kamal, Senior Member, IEEE Abstract In this paper we address the problem of traffic

More information

Edgebreaker: Connectivity compression for triangle meshes

Edgebreaker: Connectivity compression for triangle meshes J. Rossinac GVU Technical Report GIT-GVU-98-35 (revised version of GIT-GVU-98-7) pae Edebreaker: Connectivity compression for trianle meshes Jarek Rossinac GVU Center, Georia Institute of Technoloy Abstract

More information

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018

CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 CIS 121 Data Structures and Algorithms Midterm 3 Review Solution Sketches Fall 2018 Q1: Prove or disprove: You are given a connected undirected graph G = (V, E) with a weight function w defined over its

More information

Discrete mathematics II. - Graphs

Discrete mathematics II. - Graphs Emil Vatai April 25, 2018 Basic definitions Definition of an undirected graph Definition (Undirected graph) An undirected graph or (just) a graph is a triplet G = (ϕ, E, V ), where V is the set of vertices,

More information

Chapter 4. Coding systems. 4.1 Binary codes Gray (reflected binary) code

Chapter 4. Coding systems. 4.1 Binary codes Gray (reflected binary) code Chapter 4 Codin systems Codin systems define how information is mapped to numbers. Different codin systems try to store/transmit information more efficiently [Sec. 4.], or protect it from damae while it

More information

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph

Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) Web search views web pages as a graph Graphs and Trees Graphs and trees come up everywhere. We can view the internet as a graph (in many ways) who is connected to whom Web search views web pages as a graph Who points to whom Niche graphs (Ecology):

More information

Worksheet for the Final Exam - Part I. Graphs

Worksheet for the Final Exam - Part I. Graphs Worksheet for the Final Exam - Part I. Graphs Date and Time: May 10 2012 Thursday 11:50AM~1:50PM Location: Eng 120 Start with the Self-Test Exercises (pp.816) in Prichard. 1. Give the adjacency matrix

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI. Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6301 PROGRAMMING DATA STRUCTURES II Anna University 2 & 16 Mark Questions & Answers Year / Semester: II / III

More information

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms

Introduction to Parallel & Distributed Computing Parallel Graph Algorithms Introduction to Parallel & Distributed Computing Parallel Graph Algorithms Lecture 16, Spring 2014 Instructor: 罗国杰 gluo@pku.edu.cn In This Lecture Parallel formulations of some important and fundamental

More information

GRAPHS: THEORY AND ALGORITHMS

GRAPHS: THEORY AND ALGORITHMS GRAPHS: THEORY AND ALGORITHMS K. THULASIRAMAN M. N. S. SWAMY Concordia University Montreal, Canada A Wiley-Interscience Publication JOHN WILEY & SONS, INC. New York / Chichester / Brisbane / Toronto /

More information

TIE Graph algorithms

TIE Graph algorithms TIE-20106 1 1 Graph algorithms This chapter discusses the data structure that is a collection of points (called nodes or vertices) and connections between them (called edges or arcs) a graph. The common

More information

Section 08: Solutions

Section 08: Solutions Section 08: Solutions 1. Limitations and properties of shortest path algorithms (a) Draw an example of a directed graph where (a) there exists a path between two vertices s and t but (b) there is no shortest

More information

Network Flows. 1. Flows deal with network models where edges have capacity constraints. 2. Shortest paths deal with edge costs.

Network Flows. 1. Flows deal with network models where edges have capacity constraints. 2. Shortest paths deal with edge costs. Network Flows. Flows deal with network models where edges have capacity constraints. 2. Shortest paths deal with edge costs. 4 u v 2 5 s 6 5 t 4 x 2 y 3 3. Network flow formulation: A network G = (V, E).

More information

CAM Part II: Intersections

CAM Part II: Intersections CAM Part II: Intersections In the previous part, we looked at the computations of derivatives of B-Splines and NURBS. The first derivatives are of interest, since they are used in computin the tanents

More information

CS490: Problem Solving in Computer Science Lecture 6: Introductory Graph Theory

CS490: Problem Solving in Computer Science Lecture 6: Introductory Graph Theory CS490: Problem Solving in Computer Science Lecture 6: Introductory Graph Theory Dustin Tseng Mike Li Wednesday January 16, 2006 Dustin Tseng Mike Li: CS490: Problem Solving in Computer Science, Lecture

More information

Graph Representations and Traversal

Graph Representations and Traversal COMPSCI 330: Design and Analysis of Algorithms 02/08/2017-02/20/2017 Graph Representations and Traversal Lecturer: Debmalya Panigrahi Scribe: Tianqi Song, Fred Zhang, Tianyu Wang 1 Overview This lecture

More information

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1

Chapter 14. Graphs Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs 2011 Pearson Addison-Wesley. All rights reserved 14 A-1 Terminology G = {V, E} A graph G consists of two sets A set V of vertices, or nodes A set E of edges A subgraph Consists of a subset

More information

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees

Lecture 3: Recap. Administrivia. Graph theory: Historical Motivation. COMP9020 Lecture 4 Session 2, 2017 Graphs and Trees Administrivia Lecture 3: Recap Assignment 1 due 23:59 tomorrow. Quiz 4 up tonight, due 15:00 Thursday 31 August. Equivalence relations: (S), (R), (T) Total orders: (AS), (R), (T), (L) Partial orders: (AS),

More information

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G))

1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G)) 10 Graphs 10.1 Graphs and Graph Models 1. a graph G = (V (G), E(G)) consists of a set V (G) of vertices, and a set E(G) of edges (edges are pairs of elements of V (G)) 2. an edge is present, say e = {u,

More information

Chordal Graphs: Theory and Algorithms

Chordal Graphs: Theory and Algorithms Chordal Graphs: Theory and Algorithms 1 Chordal graphs Chordal graph : Every cycle of four or more vertices has a chord in it, i.e. there is an edge between two non consecutive vertices of the cycle. Also

More information

Chapter 9 Graph Algorithms

Chapter 9 Graph Algorithms Chapter 9 Graph Algorithms 2 Introduction graph theory useful in practice represent many real-life problems can be if not careful with data structures 3 Definitions an undirected graph G = (V, E) is a

More information

GEODESIC RECONSTRUCTION, SADDLE ZONES & HIERARCHICAL SEGMENTATION

GEODESIC RECONSTRUCTION, SADDLE ZONES & HIERARCHICAL SEGMENTATION Imae Anal Stereol 2001;20:xx-xx Oriinal Research Paper GEODESIC RECONSTRUCTION, SADDLE ZONES & HIERARCHICAL SEGMENTATION SERGE BEUCHER Centre de Morpholoie Mathématique, Ecole des Mines de Paris, 35, Rue

More information