-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
294 lines (294 loc) · 12.5 KB
/
.Rhistory
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
load("~/intro.RData")
network
class.g
plot(class.g)
graph(class.g)
View(network)
class.g
plot(network)
graph(class.g)
\
install.packages("igraph")
library(igraph)
net<-subset(nework, fscore>0)
net<-subset(network, fscore>0)
plot(net)
g1<-graph_from_data_frame(net,directed = TRUE,vertices = NULL)
plot(g1)
g1
network$nodeId<-NA
nodes$lastName<- carrier
nodes$lastName<- "carrier"
nodes$lastName<- NA
install.packages("igraph")
library(igraph)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv")
nodes
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv")
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv")
edges
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv")
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv")
grade8.graph<-graph_from_data_frame(edges,nodes, directed=TRUE)
grade8<-graph_from_data_frame(edges,nodes, directed=TRUE)
grade8.graph<-graph_from_data_frame(edges,nodes, directed=TRUE)
unique(nodes.name)
unique(nodes)
nodes
nodes
unique(nodes)
unique(node$node.name)
unique(nodes$node.name)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv")
unique(nodes$node.name)
unique(nodes$node.name)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
grade8.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
grade8.graph<-graph_from_data_frame(edges,unique(nodes), directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes1 <- unique(nodes)
grade8.graph<-graph_from_data_frame(edges,nodes1, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes1 <- unique(nodes)
grade8.graph<-graph_from_data_frame(edges,nodes1, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes1 <- unique(nodes)
grade8.graph<-graph_from_data_frame(edges,nodes1, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes1 <- unique(nodes$node.name)
grade8.graph<-graph_from_data_frame(edges,nodes1, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes1 <- unique(nodes$node.name)
grade8.graph<-graph_from_data_frame(edges,nodes1, directed = TRUE)
plot(grade8.graph)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade8.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade7.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade7.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade7.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade7.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
nodes
edges
grade7.graph<-graph_from_data_frame(edges,nodes, directed = TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
nodes
edges
nodes <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
nodes
edges
grade7.graph<-graph_from_data_frame(edges,nodes,directed=TRUE)
View(g1)
View(g1)
View(edges)
View(edges)
View(nodes)
View(nodes)
View(nodes)
View(nodes)
edges <- read.csv("/home/matt/Desktop/Data421/EdgesGrade8.csv",header=TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/NodesGrade8.csv",header=TRUE)
nodes
edges
grade7.graph<-graph_from_data_frame(edges,nodes,directed=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
nodes
edges
grade7.graph<-graph_from_data_frame(edges,nodes,directed=TRUE)
install.packages("igraph")
library(igraph)
edges <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
nodes
edges
grade7.graph<-graph_from_data_frame(edges,nodes,directed=TRUE)
edges <- read.csv("/home/matt/Desktop/Data421/EdgesGrade7.csv",header=TRUE)
nodes <- read.csv("/home/matt/Desktop/Data421/NodesGrade7.csv",header=TRUE)
grade7.graph<-graph_from_data_frame(edges,nodes,directed=TRUE)
vcount(grade7.graph)
ecount(grade7.graph)
plot(grade7.graph,vertex.label=V(grade7.graph)$sex.code,vertex.size=10,edge.arrow.size=0.5,vertex.color=V(grade7.graph)$sex.code)
plot(grade7.graph,vertex.label=V(grade7.graph)$sex.code,vertex.size=8,edge.arrow.size=0.5,vertex.color=V(grade7.graph)$sex.code)
hist(degree(grade7.graph,mode = "in"))
hist(degree(grade7.graph,mode="out"))
View(grade7.graph)
grade7.nodes[,4]<-(degree(grade7.graph,mode = "in")
nodes[,4]<-(degree(grade7.graph,mode = "in")
nodes[,4]<-degree(grade7.graph,mode = "in")
View(nodes)
nodes[,4]<-degree(grade7.graph,mode = "in")
mean(nodes[1..14])
nodes[,4]<-degree(grade7.graph,mode = "in")
mean(nodes[1,14])
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <= subset(grade7.graph, sex.code=1)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(grade7.graph, sex.code=1)
View(nodes)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(grade7.graph, sex.code==1)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(grade7.graph, sex.code==1)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset.data.frame(grade7.graph, sex.code==1)
View(grade7.graph)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(nodes, sex.code==1)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(nodes, sex.code==1)
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(nodes, sex.code==1)
boys
nodes[,4]<-degree(grade7.graph,mode = "in")
boys <- subset(nodes, sex.code==1)
girls<- subset(nodes, sex.code==2)
install.packages("igraph")
library(igraph)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignemnt2Nodes.csv")
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(aiports)$degree)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(aiports)$degree)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree,layout_with_sugiyama())
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree,layout_with_sugiyama(airports))
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree,layout=layout_on_sphere)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree,layout=layout_nicely)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
layout_with_fr(airports,vertex.size=V(airports)$degree*2)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
layout_with_fr(airports)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
layout_as_bipartite(airports)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
layout_as_tree(airports)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
plot(layout_as_tree(airports),vertex.size=V(airports)$degree*2)
edges<-read.csv("/home/matt/assignment2edgesv2.csv")
nodes<-read.csv("/home/matt/assignment2Nodes.csv")
airports<-graph_from_data_frame(edges,nodes,directed = F)
V(airports)$degree<-degree(airports)
plot(airports,vertex.size=V(airports)$degree*2,layout=layout_nicely)
distances(aiports)
distances(airports)
distances(airports)
diameter(airports)
diameter(airports)
distances(airports)
diameter(airports)
get_diameter(airports)
shortest_paths(airports)
shortest_paths(airports,'Charlottetown','Kamloops')
all_shortest_paths('Charlottetown','Kamloops')
all_shortest_paths(airports,'Charlottetown','Kamloops')
all_shortest_paths(airports,'Charlottetown','Kamloops')
all_shortest_paths(airports,'Victoria','QuebecCity')
library(igraph)
install.packages("igraph")
library(igraph)
install.packages("igraph")
library(igraph)
install.packages("igraph")
library(igraph)
library(igraph)
install.packages("igraph")
install.packages("igraph")
install.packages("igraph")
library(igraph)
install.packages("igraph")
install.packages("igraph")
library(igraph)
source('~/.active-rstudio-document', echo=TRUE)
source('~/.active-rstudio-document', echo=TRUE)
setwd("/home/matt/data421/Data421Project")
df86<-read.csv("output_data1986(regions).csv")
df86<-read.csv("output_data1986(regions).csv")
head(df86)
df86<-read.csv("output_data1986(regions).csv")
df96<-read.csv("output_data1996(regions).csv")
df06<-read.csv("output_data2006(regions).csv")
df16<-read.csv("output_data2016(regions).csv")
library(igraph)
install.packages("igraph")
library(igraph)
library(igraph)