In this project we create different team data types to test our product in those different scenarios.
10*2 scenarios are created.
In each scenario we build on the mutual work relationship in the first step.
Then we add some random, non-mutual edges to the graph (unless it was a full graph originally).
In the second step we create a structurally good and a structurally poor initiative network.
Finally in the third step we add a structurally good and a structurally poor information network.
As a result we have a good and a poor team structure for all the 10 scenarios.
The output files are:
1 node list,
1 edge list for the good team,
1 edge list for the poor team.
# <code R>
# ===================================================================
#
# Survey Analysis:
#
# Team-ray
# Testing team data
# Aug / 25 /2014
#
# ===================================================================
# In Drive: https://drive.google.com/a/cx-ray.com/?usp=folder#folders/0B4jw-3qbSTPKUzZJbEF2RzVmTHM
# Here we create different team data types to test our product in different scenarios
# http://igraph.org/r/doc/graph.constructors.html
# http://igraph.org/r/doc/attributes.html
# http://www.inside-r.org/packages/cran/igraph/docs/add.edges
# Types:
# testdat_01 N=5, 1 full graph
# testdat_02 N=5, 1 triangle, with 2 isolates
# testdat_03 N=8, 1 full graph
# testdat_04 N=9, 2*4 full graph, + 1 broker
# testdat_05 N=10, 1 5star, + 4 isolates
# testdat_06 N=16, 4*4 click, 4 brokers, (caveman graph)
# testdat_07 N=30, 2 6stars (n=14), + 16 isolates
# testdat_08 N=30 full graph
# testdat_09 N=31 6*5 full graph, + 1 central node (boss), 1 tie to each click
# testdat_10 N=36 hierarchy: 1 - 4 - 4, + 15 isolates (1*4+4*4+15)
# ===================================================================
# (0) LIBRARY AND WD
# ===================================================================
# (0.1) libraries
library(igraph)
# (0.2) working directory
# rm(list=ls())
# whoareyou <- "NB"
# path <- paste0("c:\\Users\\",whoareyou,"\\Dropbox\\My_Cx_Ray\\spar\\spar_orgchart_dashboard_analysis\\")
# setwd(path)
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# ===================================================================
# (1) testdat_01
# ===================================================================
# (1.1) mutual work relation
# (1.1.1) basic relations
g1 <- graph.full(5, directed = T)
g1 <- set.vertex.attribute(g1, "name", value=c("1", "2", "3", "4", "5"))
testdat_01_node <- get.data.frame(g1, what = "vertice")
testdat_0101_edge <- get.data.frame(g1, what = "edge")
testdat_0101_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (1.2.1) adding extra edges
# no extra edges added here, since this is a full graph
# (1.2) initiation relation
# (1.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1,5,10,16)) # removing 4 out of 20 edges
testdat_0102g_edge <- get.data.frame(g2g, what = "edge")
testdat_0102g_edge$q <- 2
g2g
## IGRAPH DN-- 5 16 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (1.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:3,5:6,10:12,16:17)) # removing 10 out of 20 edges
testdat_0102p_edge <- get.data.frame(g2p, what = "edge")
testdat_0102p_edge$q <- 2
g2p
## IGRAPH DN-- 5 10 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (1.3) information relation
# (1.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2,6,11,17)) # removing 4 out of 20 edges
testdat_0103g_edge <- get.data.frame(g3g, what = "edge")
testdat_0103g_edge$q <- 3
g3g
## IGRAPH DN-- 5 16 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (1.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:4,6:7,11:13,17:18)) # removing 10 out of 20 edges
testdat_0103p_edge <- get.data.frame(g3p, what = "edge")
testdat_0103p_edge$q <- 3
g3p
## IGRAPH DN-- 5 10 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (1.4) final testdat_01 data
# (1.4.1) nodes
write.table(testdat_01_node , file="testdat_01_nodes.csv", sep=";", row.names = F, col.names = F)
# (1.4.2) edges
testdat_01g <- rbind(testdat_0101_edge, testdat_0102g_edge, testdat_0103g_edge)
write.table(testdat_01g , file="testdat_01_edge_g.csv", sep=";", row.names = F)
testdat_01p <- rbind(testdat_0101_edge, testdat_0102p_edge, testdat_0103p_edge)
write.table(testdat_01p , file="testdat_01_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (2) testdat_02
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (2.1) mutual work relation
# (2.1.1) basic relations
g1 <- graph.full(3, directed = T)
g1 <- g1 + c("4", "5") # add 2 vertices
g1 <- set.vertex.attribute(g1, "name", value=c("1", "2", "3", "4", "5"))
testdat_02_node <- get.data.frame(g1, what = "vertice")
testdat_0201_edge <- get.data.frame(g1, what = "edge")
testdat_0201_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (2.2.1) adding extra edges
g1 <- g1 + edges("4", "5", "5", "2", "3", "5") # add 3 edges
testdat_0201_edge <- get.data.frame(g1, what = "edge")
testdat_0201_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (2.2) initiation relation
# (2.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1,4)) # removing 2 out of 9 edges
testdat_0202g_edge <- get.data.frame(g2g, what = "edge")
testdat_0202g_edge$q <- 2
g2g
## IGRAPH DN-- 5 7 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (2.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4:5, 7)) # removing 5 out of 9 edges
testdat_0202p_edge <- get.data.frame(g2p, what = "edge")
testdat_0202p_edge$q <- 2
g2p
## IGRAPH DN-- 5 4 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (2.3) information relation
# (2.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2,5)) # removing 2 out of 9 edges
testdat_0203g_edge <- get.data.frame(g3g, what = "edge")
testdat_0203g_edge$q <- 3
g3g
## IGRAPH DN-- 5 7 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (2.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 5:6, 8)) # removing 5 out of 9 edges
testdat_0203p_edge <- get.data.frame(g3p, what = "edge")
testdat_0203p_edge$q <- 3
g3p
## IGRAPH DN-- 5 4 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (2.4) final testdat_01 data
# (2.4.1) nodes
write.table(testdat_02_node , file="testdat_02_nodes.csv", sep=";", row.names = F, col.names = F)
# (2.4.2) edges
testdat_02g <- rbind(testdat_0201_edge, testdat_0202g_edge, testdat_0203g_edge)
write.table(testdat_02g , file="testdat_02_edge_g.csv", sep=";", row.names = F)
testdat_02p <- rbind(testdat_0201_edge, testdat_0202p_edge, testdat_0203p_edge)
write.table(testdat_02p , file="testdat_02_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (3) testdat_03
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (3.1) mutual work relation
# (3.1.1) basic relations
g1 <- graph.full(8, directed = T)
g1 <- set.vertex.attribute(g1, "name", value=c("1", "2", "3", "4", "5", "6", "7", "8"))
testdat_03_node <- get.data.frame(g1, what = "vertice")
testdat_0301_edge <- get.data.frame(g1, what = "edge")
testdat_0301_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (3.2.1) adding extra edges
# no extra edges added here, since this is a full graph
# (3.2) initiation relation
# (3.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1:2, 8:9, 15:16, 22:23, 29:30, 36:37)) # removing 12 out of 56 edges
testdat_0302g_edge <- get.data.frame(g2g, what = "edge")
testdat_0302g_edge$q <- 2
g2g
## IGRAPH DN-- 8 44 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (3.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:4, 8:11, 15:18, 22:25, 29:32, 36:38, 43:45, 50:52)) # removing 29 out of 56 edges
testdat_0302p_edge <- get.data.frame(g2p, what = "edge")
testdat_0302p_edge$q <- 2
g2p
## IGRAPH DN-- 8 27 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (3.3) information relation
# (3.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2:3, 9:10, 16:17, 23:24, 30:31, 37:38)) # removing 12 out of 56 edges
testdat_0303g_edge <- get.data.frame(g3g, what = "edge")
testdat_0303g_edge$q <- 3
g3g
## IGRAPH DN-- 8 44 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (3.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:5, 9:12, 16:19, 23:26, 30:33, 37:39, 44:46, 51:53)) # removing 29 out of 56 edges
testdat_0303p_edge <- get.data.frame(g3p, what = "edge")
testdat_0303p_edge$q <- 3
g3p
## IGRAPH DN-- 8 27 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (3.4) final testdat_01 data
# (3.4.1) nodes
write.table(testdat_03_node , file="testdat_03_nodes.csv", sep=";", row.names = F, col.names = F)
# (3.4.2) edges
testdat_03g <- rbind(testdat_0301_edge, testdat_0302g_edge, testdat_0303g_edge)
write.table(testdat_03g , file="testdat_03_edge_g.csv", sep=";", row.names = F)
testdat_03p <- rbind(testdat_0301_edge, testdat_0302p_edge, testdat_0303p_edge)
write.table(testdat_03p , file="testdat_03_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (4) testdat_04
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (4.1) mutual work relation
# (4.1.1) basic relations
g1a <- graph.full(4, directed = T)
g1a <- set.vertex.attribute(g1a, "name", value=c("1", "2", "3", "4"))
plot(g1a)
g1a
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1b <- graph.full(4, directed = T)
g1b <- set.vertex.attribute(g1b, "name", value=c("5", "6", "7", "8"))
plot(g1b)
g1b
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1 <- graph.union(g1a, g1b)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (4.1.2) adding extra edges
g1 <- g1 + c("9")
g1 <- g1 + edges("7", "9", "9", "7", "9", "3", "3", "9") # add 4 edges
testdat_04_node <- get.data.frame(g1, what = "vertice")
testdat_0401_edge <- get.data.frame(g1, what = "edge")
testdat_0401_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 9 28 --
## + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
## name (v/c)
# (4.2) initiation relation
# (4.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1, 4, 7, 10, 13, 16)) # removing 6 out of 28 edges
testdat_0402g_edge <- get.data.frame(g2g, what = "edge")
testdat_0402g_edge$q <- 2
g2g
## IGRAPH DN-- 9 22 --
## + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
## name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (4.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4:5, 7:8, 10:11, 13:14, 16:17, 19:22)) # removing 16 out of 28 edges
testdat_0402p_edge <- get.data.frame(g2p, what = "edge")
testdat_0402p_edge$q <- 2
g2p
## IGRAPH DN-- 9 12 --
## + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
## name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (4.3) information relation
# (4.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2, 5, 8, 11, 14, 17)) # removing 12 out of 56 edges
testdat_0403g_edge <- get.data.frame(g3g, what = "edge")
testdat_0403g_edge$q <- 3
g3g
## IGRAPH DN-- 9 22 --
## + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
## name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (4.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 5:6, 8:9, 11:12, 14:15, 17:18, 20:23)) # removing 29 out of 56 edges
testdat_0403p_edge <- get.data.frame(g3p, what = "edge")
testdat_0403p_edge$q <- 3
g3p
## IGRAPH DN-- 9 12 --
## + attr: name_1 (g/c), name_2 (g/c), loops_1 (g/l), loops_2 (g/l),
## name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (4.4) final testdat_01 data
# (4.4.1) nodes
write.table(testdat_04_node , file="testdat_04_nodes.csv", sep=";", row.names = F, col.names = F)
# (4.4.2) edges
testdat_04g <- rbind(testdat_0401_edge, testdat_0402g_edge, testdat_0403g_edge)
write.table(testdat_04g , file="testdat_04_edge_g.csv", sep=";", row.names = F)
testdat_04p <- rbind(testdat_0401_edge, testdat_0402p_edge, testdat_0403p_edge)
write.table(testdat_04p , file="testdat_04_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (5) testdat_05
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (5.1) mutual work relation
# (5.1.1) basic relations
g1 <- graph.empty() +
vertices("1", "2", "3", "4", "5", "6", "7", "8", "9", "10") +
edges("1", "2", "2", "1",
"1", "3", "3", "1",
"1", "4", "4", "1",
"1", "5", "5", "1")
g1
## IGRAPH DN-- 10 8 --
## + attr: name (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (5.1.2) adding extra edges
g1 <- g1 + edges("7", "9", "10", "8", "7", "10") # add 3 edges
testdat_05_node <- get.data.frame(g1, what = "vertice")
testdat_0501_edge <- get.data.frame(g1, what = "edge")
testdat_0501_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 10 11 --
## + attr: name (v/c)
# (5.2) initiation relation
# (5.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1, 3)) # removing 2 out of 11 edges
testdat_0502g_edge <- get.data.frame(g2g, what = "edge")
testdat_0502g_edge$q <- 2
g2g
## IGRAPH DN-- 10 9 --
## + attr: name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (5.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1, 3, 5, 7, 9, 10)) # removing 6 out of 11 edges
testdat_0502p_edge <- get.data.frame(g2p, what = "edge")
testdat_0502p_edge$q <- 2
g2p
## IGRAPH DN-- 10 5 --
## + attr: name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (5.3) information relation
# (5.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2, 4)) # removing 2 out of 11 edges
testdat_0503g_edge <- get.data.frame(g3g, what = "edge")
testdat_0503g_edge$q <- 3
g3g
## IGRAPH DN-- 10 9 --
## + attr: name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (5.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2, 4, 6, 8, 10, 11)) # removing 6 out of 11 edges
testdat_0503p_edge <- get.data.frame(g3p, what = "edge")
testdat_0503p_edge$q <- 3
g3p
## IGRAPH DN-- 10 5 --
## + attr: name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (5.4) final testdat_01 data
# (5.4.1) nodes
write.table(testdat_05_node , file="testdat_05_nodes.csv", sep=";", row.names = F, col.names = F)
# (5.4.2) edges
testdat_05g <- rbind(testdat_0501_edge, testdat_0502g_edge, testdat_0503g_edge)
write.table(testdat_05g , file="testdat_05_edge_g.csv", sep=";", row.names = F)
testdat_05p <- rbind(testdat_0501_edge, testdat_0502p_edge, testdat_0503p_edge)
write.table(testdat_05p , file="testdat_05_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (6) testdat_06
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (6.1) mutual work relation
# (6.1.1) basic relations
g1a <- graph.full(4, directed = T)
g1a <- set.vertex.attribute(g1a, "name", value=c("1", "2", "3", "4"))
plot(g1a)
g1a
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1b <- graph.full(4, directed = T)
g1b <- set.vertex.attribute(g1b, "name", value=c("5", "6", "7", "8"))
plot(g1b)
g1b
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1c <- graph.full(4, directed = T)
g1c <- set.vertex.attribute(g1c, "name", value=c("9", "10", "11", "12"))
plot(g1c)
g1c
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1d <- graph.full(4, directed = T)
g1d <- set.vertex.attribute(g1d, "name", value=c("13", "14", "15", "16"))
plot(g1d)
g1d
## IGRAPH DN-- 4 12 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1 <- graph.union(g1a, g1b, g1c, g1d)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1 <- g1 + edges("1", "5", "5", "1",
"7","9", "9", "7",
"11", "13", "13", "11")
g1
## IGRAPH DN-- 16 54 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (6.1.2) adding extra edges
g1 <- g1 + edges("16", "4", "9", "1", "3", "10", "7", "13", "5", "11") # add 5 edges
testdat_06_node <- get.data.frame(g1, what = "vertice")
testdat_0601_edge <- get.data.frame(g1, what = "edge")
testdat_0601_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 16 59 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
# (6.2) initiation relation
# (6.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1, 4, 7, 10, 16, 19, 25, 28, 31, 34, 37, 51)) # removing 12 out of 59 edges
testdat_0602g_edge <- get.data.frame(g2g, what = "edge")
testdat_0602g_edge$q <- 2
g2g
## IGRAPH DN-- 16 47 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (6.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4, 7, 10:11, 13:14, 16:17, 19:20, 25:26, 28, 31, 34:35, 37, 51:53, 57:58)) # removing 33 out of 59 edges
testdat_0602p_edge <- get.data.frame(g2p, what = "edge")
testdat_0602p_edge$q <- 2
g2p
## IGRAPH DN-- 16 35 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (6.3) information relation
# (6.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2, 5, 8, 11, 17, 20, 25, 28, 32, 35, 37, 52)) # removing 2 out of 59 edges
testdat_0603g_edge <- get.data.frame(g3g, what = "edge")
testdat_0603g_edge$q <- 3
g3g
## IGRAPH DN-- 16 47 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (6.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 5, 7, 11:12, 14:15, 17:18, 20:21, 26:27, 29, 31, 35:36, 37, 51:53, 57:59)) # removing 25 out of 59 edges
testdat_0603p_edge <- get.data.frame(g3p, what = "edge")
testdat_0603p_edge$q <- 3
g3p
## IGRAPH DN-- 16 34 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## loops_1 (g/l), loops_2 (g/l), loops_3 (g/l), loops_4 (g/l), name
## (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (6.4) final testdat_01 data
# (6.4.1) nodes
write.table(testdat_06_node , file="testdat_06_nodes.csv", sep=";", row.names = F, col.names = F)
# (6.4.2) edges
testdat_06g <- rbind(testdat_0601_edge, testdat_0602g_edge, testdat_0603g_edge)
write.table(testdat_06g , file="testdat_06_edge_g.csv", sep=";", row.names = F)
testdat_06p <- rbind(testdat_0601_edge, testdat_0602p_edge, testdat_0603p_edge)
write.table(testdat_06p , file="testdat_06_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (7) testdat_07
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (7.1) mutual work relation
# (7.1.1) basic relations
g1 <- graph.empty() +
vertices("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30") +
edges("1", "2", "2", "1",
"1", "3", "3", "1",
"1", "4", "4", "1",
"1", "5", "5", "1",
"1", "6", "6", "1",
"12", "7", "7", "12",
"12", "8", "8", "12",
"12", "9", "9", "12",
"12", "10", "10", "12",
"12", "11", "11", "12")
g1
## IGRAPH DN-- 30 20 --
## + attr: name (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (7.1.2) adding extra edges
g1 <- g1 + edges("16", "4", "9", "21", "3", "15", "27", "13", "18", "26") # add 5 edges
testdat_07_node <- get.data.frame(g1, what = "vertice")
testdat_0701_edge <- get.data.frame(g1, what = "edge")
testdat_0701_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 30 25 --
## + attr: name (v/c)
# (7.2) initiation relation
# (7.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1, 4, 7, 10, 13)) # removing 5 out of 25 edges
testdat_0702g_edge <- get.data.frame(g2g, what = "edge")
testdat_0702g_edge$q <- 2
g2g
## IGRAPH DN-- 30 20 --
## + attr: name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (7.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4:5, 7:8, 10:11, 13:14, 16:17)) # removing 12 out of 25 edges
testdat_0702p_edge <- get.data.frame(g2p, what = "edge")
testdat_0702p_edge$q <- 2
g2p
## IGRAPH DN-- 30 13 --
## + attr: name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (7.3) information relation
# (7.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2, 5, 8, 11, 14)) # removing 5 out of 25 edges
testdat_0703g_edge <- get.data.frame(g3g, what = "edge")
testdat_0703g_edge$q <- 3
g3g
## IGRAPH DN-- 30 20 --
## + attr: name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (7.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 5:6, 8:9, 11:12, 14:15, 17:18)) # removing 12 out of 25 edges
testdat_0703p_edge <- get.data.frame(g3p, what = "edge")
testdat_0703p_edge$q <- 3
g3p
## IGRAPH DN-- 30 13 --
## + attr: name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (7.4) final testdat_01 data
# (7.4.1) nodes
write.table(testdat_07_node , file="testdat_07_nodes.csv", sep=";", row.names = F, col.names = F)
# (7.4.2) edges
testdat_07g <- rbind(testdat_0701_edge, testdat_0702g_edge, testdat_0703g_edge)
write.table(testdat_07g , file="testdat_07_edge_g.csv", sep=";", row.names = F)
testdat_07p <- rbind(testdat_0701_edge, testdat_0702p_edge, testdat_0703p_edge)
write.table(testdat_07p , file="testdat_07_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (8) testdat_08
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (8.1) mutual work relation
# (8.1.1) basic relations
g1 <- graph.full(30, directed = T)
g1 <- set.vertex.attribute(g1, "name",
value=c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30"))
testdat_08_node <- get.data.frame(g1, what = "vertice")
testdat_0801_edge <- get.data.frame(g1, what = "edge")
testdat_0801_edge$q <- 1
g1
## IGRAPH DN-- 30 870 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (8.1.2) adding extra edges
# no extra edges added here, since this is a full graph
# (8.2) initiation relation
# (8.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1:10, 25:35, 50:60, 75:85,
10:110, 125:135, 150:160,
300:305,
635:640,
815:820)) # removing 150 out of 870 edges
testdat_0802g_edge <- get.data.frame(g2g, what = "edge")
testdat_0802g_edge$q <- 2
g2g
## IGRAPH DN-- 30 720 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (8.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:10, 25:35, 50:60, 75:85,
100:130, 125:135, 150:180,
200:230, 250:280,
302:337, 345:399,
435:455,
547:582, 510:525,
636:656, 670:699,
713:756, 790:810,
835:860)) # removing 478 out of 870 edges
testdat_0802p_edge <- get.data.frame(g2p, what = "edge")
testdat_0802p_edge$q <- 2
g2p
## IGRAPH DN-- 30 392 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (8.3) information relation
# (8.3.1) information relation, good fit
g3g <- delete.edges(g1, c(3:12, 27:37, 52:62, 77:87,
12:112, 128:138, 158:168,
303:308,
633:643,
818:823)) # removing 155 out of 870 edges
testdat_0803g_edge <- get.data.frame(g3g, what = "edge")
testdat_0803g_edge$q <- 3
g3g
## IGRAPH DN-- 30 715 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (8.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(1:10, 28:38, 50:60, 75:85,
100:130, 125:135, 160:190,
200:230, 250:280,
302:337, 345:399,
415:435,
547:582, 510:525,
636:656, 670:699,
713:756, 790:810,
815:840)) # removing 478 out of 870 edges
testdat_0803p_edge <- get.data.frame(g3p, what = "edge")
testdat_0803p_edge$q <- 3
g3p
## IGRAPH DN-- 30 392 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (8.4) final testdat_01 data
# (8.4.1) nodes
write.table(testdat_08_node , file="testdat_08_nodes.csv", sep=";", row.names = F, col.names = F)
# (8.4.2) edges
testdat_08g <- rbind(testdat_0801_edge, testdat_0802g_edge, testdat_0803g_edge)
write.table(testdat_08g , file="testdat_08_edge_g.csv", sep=";", row.names = F)
testdat_08p <- rbind(testdat_0801_edge, testdat_0802p_edge, testdat_0803p_edge)
write.table(testdat_08p , file="testdat_08_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (9) testdat_09
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (9.1) mutual work relation
# (9.1.1) basic relations
g1a <- graph.full(5, directed = T)
g1a <- set.vertex.attribute(g1a, "name", value=c("1", "2", "3", "4", "5"))
plot(g1a)
g1a
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1b <- graph.full(5, directed = T)
g1b <- set.vertex.attribute(g1b, "name", value=c("6", "7", "8", "9", "10"))
plot(g1b)
g1b
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1c <- graph.full(5, directed = T)
g1c <- set.vertex.attribute(g1c, "name", value=c("11", "12", "13", "14", "15"))
plot(g1c)
g1c
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1d <- graph.full(5, directed = T)
g1d <- set.vertex.attribute(g1d, "name", value=c("16", "17", "18", "19", "20"))
plot(g1d)
g1d
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1e <- graph.full(5, directed = T)
g1e <- set.vertex.attribute(g1e, "name", value=c("21", "22", "23", "24", "25"))
plot(g1e)
g1e
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1f <- graph.full(5, directed = T)
g1f <- set.vertex.attribute(g1f, "name", value=c("26", "27", "28", "29", "30"))
plot(g1f)
g1f
## IGRAPH DN-- 5 20 -- Full graph
## + attr: name (g/c), loops (g/l), name (v/c)
g1 <- graph.union(g1a, g1b, g1c, g1d, g1e, g1f)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1 <- g1 + c("31")
g1 <- g1 + edges("1", "31", "31", "1",
"6", "31", "31", "6",
"11", "31", "31", "11",
"16", "31", "31", "16",
"21", "31", "31", "21",
"26", "31", "31", "26")
g1
## IGRAPH DN-- 31 132 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (9.1.2) adding extra edges
g1 <- g1 + edges("16", "4", "9", "1", "3", "10", "7", "13", "5", "11",
"17", "6", "10", "2", "6", "12", "8", "14", "6", "21") # add 10 edges
testdat_09_node <- get.data.frame(g1, what = "vertice")
testdat_0901_edge <- get.data.frame(g1, what = "edge")
testdat_0901_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 31 142 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
# (9.2) initiation relation
# (9.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1:2, 4:5, 7:8, 10:11, 16:17, 19:20, 25:26,
28:29, 31:33, 34:35, 37:38, 51:52)) # removing 25 out of 142 edges
testdat_0902g_edge <- get.data.frame(g2g, what = "edge")
testdat_0902g_edge$q <- 2
g2g
## IGRAPH DN-- 31 117 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (9.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4:5, 7:8, 10:11, 16:17, 19:20, 25:26,
28:29, 31:33, 34:35, 37:38, 51:52, 59:53,
77:85, 95:99, 111:119, 122:131, 135:138)) # removing 71 out of 142 edges
testdat_0902p_edge <- get.data.frame(g2p, what = "edge")
testdat_0902p_edge$q <- 2
g2p
## IGRAPH DN-- 31 73 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (9.3) information relation
# (9.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2:3, 5:6, 8:9, 11:12, 16:17, 20:21, 25:26,
29:30, 32:34, 35:36, 38:39, 51:52)) # removing 25 out of 142 edges
testdat_0903g_edge <- get.data.frame(g3g, what = "edge")
testdat_0903g_edge$q <- 3
g3g
## IGRAPH DN-- 31 117 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (9.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 5:6, 8:9, 11:12, 16:17, 20:21, 25:26,
29:30, 32:34, 35:36, 38:39, 51:53, 58:65,
78:86, 96:100, 112:120, 123:132, 136:139)) # removing 71 out of 142 edges
testdat_0903p_edge <- get.data.frame(g3p, what = "edge")
testdat_0903p_edge$q <- 3
g3p
## IGRAPH DN-- 31 71 --
## + attr: name_1 (g/c), name_2 (g/c), name_3 (g/c), name_4 (g/c),
## name_5 (g/c), name_6 (g/c), loops_1 (g/l), loops_2 (g/l),
## loops_3 (g/l), loops_4 (g/l), loops_5 (g/l), loops_6 (g/l), name
## (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (9.4) final testdat_01 data
# (9.4.1) nodes
write.table(testdat_09_node , file="testdat_09_nodes.csv", sep=";", row.names = F, col.names = F)
# (9.4.2) edges
testdat_09g <- rbind(testdat_0901_edge, testdat_0902g_edge, testdat_0903g_edge)
write.table(testdat_09g , file="testdat_09_edge_g.csv", sep=";", row.names = F)
testdat_09p <- rbind(testdat_0901_edge, testdat_0902p_edge, testdat_0903p_edge)
write.table(testdat_09p , file="testdat_09_edge_p.csv", sep=";", row.names = F)
# ===================================================================
# (10) testdat_10
# ===================================================================
rm(list=ls())
whoareyou <- "balint"
path <- paste0("/home/",whoareyou,"/Dropbox/My_Cx_Ray/team_ray/")
setwd(path)
# (10.1) mutual work relation
# (10.1.1) basic relations
g1 <- graph.empty() +
vertices("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
"21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
"31", "32", "33", "34", "35", "36") +
edges("1", "2", "2", "1", # 1
"1", "3", "3", "1",
"1", "4", "4", "1",
"1", "5", "5", "1",
"2", "6", "6", "2", # 1.1
"2", "7", "7", "2",
"2", "8", "8", "2",
"2", "9", "9", "2",
"3", "10", "10", "3", # 1.2
"3", "11", "11", "3",
"3", "12", "12", "3",
"3", "13", "13", "3",
"4", "14", "14", "4", # 1.3
"4", "15", "15", "4",
"4", "16", "16", "4",
"4", "17", "17", "4",
"5", "18", "18", "5", # 1.3
"5", "19", "19", "5",
"5", "20", "20", "5",
"5", "21", "21", "5")
g1
## IGRAPH DN-- 36 40 --
## + attr: name (v/c)
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
# (10.1.2) adding extra edges
g1 <- g1 + edges("16", "4", "9", "21", "3", "15", "27", "13", "18", "26") # add 5 edges
testdat_10_node <- get.data.frame(g1, what = "vertice")
testdat_1001_edge <- get.data.frame(g1, what = "edge")
testdat_1001_edge$q <- 1
plot(g1, edge.arrow.size=0.3, vertex.size=E(g1)$size)
g1
## IGRAPH DN-- 36 45 --
## + attr: name (v/c)
# (10.2) initiation relation
# (10.2.1) initiation relation, good fit
g2g <- delete.edges(g1, c(1, 4, 7, 10, 13, 19, 22)) # removing 7 out of 45 edges
testdat_1002g_edge <- get.data.frame(g2g, what = "edge")
testdat_1002g_edge$q <- 2
g2g
## IGRAPH DN-- 36 38 --
## + attr: name (v/c)
plot(g2g, edge.arrow.size=0.3, vertex.size=E(g2g)$size)
# (10.2.2) initiation relation, poor fit
g2p <- delete.edges(g1, c(1:2, 4:5, 7:8, 10:11, 13:14, 16:17,
19:20, 22:25, 30:33)) # removing 22 out of 45 edges
testdat_1002p_edge <- get.data.frame(g2p, what = "edge")
testdat_1002p_edge$q <- 2
g2p
## IGRAPH DN-- 36 23 --
## + attr: name (v/c)
plot(g2p, edge.arrow.size=0.3, vertex.size=E(g2p)$size)
# (10.3) information relation
# (10.3.1) information relation, good fit
g3g <- delete.edges(g1, c(2, 6, 8, 12, 15, 20, 22)) # removing 7 out of 45 edges
testdat_1003g_edge <- get.data.frame(g3g, what = "edge")
testdat_1003g_edge$q <- 3
g3g
## IGRAPH DN-- 36 38 --
## + attr: name (v/c)
plot(g3g, edge.arrow.size=0.3, vertex.size=E(g3g)$size)
# (10.3.2) information relation, poor fit
g3p <- delete.edges(g1, c(2:3, 4:5, 7:8, 10:11, 13:14, 16:17,
19:20, 22:24, 30:34)) # removing 22 out of 45 edges
testdat_1003p_edge <- get.data.frame(g3p, what = "edge")
testdat_1003p_edge$q <- 3
g3p
## IGRAPH DN-- 36 23 --
## + attr: name (v/c)
plot(g3p, edge.arrow.size=0.3, vertex.size=E(g3p)$size)
# (10.4) final testdat_01 data
# (10.4.1) nodes
write.table(testdat_10_node , file="testdat_10_nodes.csv", sep=";", row.names = F, col.names = F)
# (10.4.2) edges
testdat_10g <- rbind(testdat_1001_edge, testdat_1002g_edge, testdat_1003g_edge)
write.table(testdat_10g , file="testdat_10_edge_g.csv", sep=";", row.names = F)
testdat_10p <- rbind(testdat_1001_edge, testdat_1002p_edge, testdat_1003p_edge)
write.table(testdat_10p , file="testdat_10_edge_p.csv", sep=";", row.names = F)
# </code>
# </code>