igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[igraph] Subgraphs Union


From: Romildo Martins
Subject: [igraph] Subgraphs Union
Date: Thu, 9 Dec 2010 09:55:17 -0300

Hello,

How to join the subgraphs (sub1 and sub2) to construct the network graph?
Note that you must include (automatically) the edges (2,4) and (3,5)

Thanks

Romildo Martins Bezerra

#######################

network<- graph(c(0,1,1,2,2,3,3,0,1,3,2,4,3,5,4,5,4,6,5,6), directed=FALSE )
network <- graph.adjacency(get.adjacency(network),mode="undirected")
E(network)$capacity<-c(100,120,120,120,140,80,160,100,120,180)
V(network)$name<-c(0,1,2,3,4,5,6)


#show network
plot(network,vertex.shape="circle",
layout=layout.kamada.kawai,vertex.label=V(network)$name,
edge.label=E(network)$capacity)


sub1<- graph(c(0,1,1,2,2,3,3,0,1,3), directed=FALSE )
sub1 <- graph.adjacency(get.adjacency(sub1),mode="undirected")
V(sub1)$name<-c(0,1,2,3)
#show sub1
plot(sub1,vertex.shape="circle",
layout=layout.kamada.kawai,vertex.label=V(sub1)$name,
edge.label=E(sub1)$capacity)


sub2<- graph(c(0,1,1,2,2,0), directed=FALSE )
sub2 <- graph.adjacency(get.adjacency(sub2),mode="undirected")
V(sub2)$name<-c(4,5,6)
#show sub2
plot(sub2,vertex.shape="circle",
layout=layout.kamada.kawai,vertex.label=V(sub2)$name,
edge.label=E(sub2)$capacity)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]