Drake Gossi
2019-May-05 00:34 UTC
[R] what would break a citation network? [Error in as.igraph.vs(graph, vids) : Invalid vertex names]
Hello everyone,
I'm trying to learn how to put together a citation network, and, in
doing so, I'm playing around with a data set of my own making. I'm
going back and forth between two .csv files. One has two columns and
is simply labeled "to" and "from":
to from
rickert heidegger
rickert nietzsche
rickert parmenides
rickert diogenes
rickert latour
rickert haraway
rickert barad
rickert burke
boyle mackenzie
boyle flusser
boyle kittler
boyle massumi
boyle mattern
boyle rickert
boyle berlant
boyle ulmer
boyle manovich
boyle burke
So, rickert and boyle are academics, and the people to the right are
other scholars they cite. This one .csv file goes on for 75 rows like
this.
But I have another file too, which looks like this. The two columns
are "author" and "association":
author association
latour STS
burke rhetoric
kittler media theory
heidegger philosophy
barthes philosophy
mackenzie media theory
massumi affect theory
nietzsche philosophy
flusser media theory
rickert rhetoric
spinuzzi tech comm
boyle rhetoric
gries rhetoric
jeff rice rhetoric
jenny rice rhetoric
gunn rhetoric
rivers rhetoric
mol STS
stengers STS
barad STS
braidotti posthumanism
wolfe posthumanism
haraway STS
The trouble is, when I add the following (davis, rhetoric) onto the
second list, the citation network breaks.
...
...
braidotti posthumanism
wolfe posthumanism
haraway STS
davis rhetoric
My question is: why would the addition of a single row break the
analysis? I am getting this error message:
Error in as.igraph.vs(graph, vids) : Invalid vertex names
My code is this:
install.packages("igraph")
library(igraph)
myEdgeList <- as.matrix(read.csv("myEdgeList.csv", as.is=TRUE))
G <- graph.edgelist(myEdgeList, directed=FALSE)
myThemes <- read.csv("myThemes.csv", as.is=TRUE)
rowNumberofMatchingCases <- which(myThemes$association %in%
c("rhetoric"
))
authorsOfMatchingCases <- myThemes$author [rowNumberofMatchingCases]
H <- induced.subgraph (G, authorsOfMatchingCases)
lout <- layout.fruchterman.reingold(H)
plot.igraph(H, layout=lout, vertex.size=5, vertex.label.cex=.5)
My guess is I have broken some fundamental rule of graphing, like one
of the names performs too many functions in the graph, or I have
"rhetoric" too many times in the is the second csv file...
But I really think the better question is: if you were just fooling
around and trying to make a citation network from hand and by scratch,
like I'm doing, what could you not do with the list? and does this
have something to do with transitivity?
Drake
K. Elo
2019-May-05 05:35 UTC
[R] what would break a citation network? [Error in as.igraph.vs(graph, vids) : Invalid vertex names]
Hi Drake, 2019-05-04, 17:34 -0700, Drake Gossi wrote:> Hello everyone, > > I'm trying to learn how to put together a citation network, and, in > doing so, I'm playing around with a data set of my own making. I'm > going back and forth between two .csv files. One has two columns and > is simply labeled "to" and "from": > > to from > rickert heidegger > rickert nietzsche > rickert parmenides > rickert diogenes > rickert latour > rickert haraway > rickert barad > rickert burke > boyle mackenzie > boyle flusser > boyle kittler > boyle massumi > boyle mattern > boyle rickert > boyle berlant > boyle ulmer > boyle manovich > boyle burke > > So, rickert and boyle are academics, and the people to the right are > other scholars they cite. This one .csv file goes on for 75 rows like > this. > > But I have another file too, which looks like this. The two columns > are "author" and "association": > > author association > latour STS > burke rhetoric > kittler media theory > heidegger philosophy > barthes philosophy > mackenzie media theory > massumi affect theory > nietzsche philosophy > flusser media theory > rickert rhetoric > spinuzzi tech comm > boyle rhetoric > gries rhetoric > jeff rice rhetoric > jenny rice rhetoric > gunn rhetoric > rivers rhetoric > mol STS > stengers STS > barad STS > braidotti posthumanism > wolfe posthumanism > haraway STS > > The trouble is, when I add the following (davis, rhetoric) onto the > second list, the citation network breaks. > > ... > ... > braidotti posthumanism > wolfe posthumanism > haraway STS > davis rhetoric > > My question is: why would the addition of a single row break the > analysis? I am getting this error message: > > Error in as.igraph.vs(graph, vids) : Invalid vertex names > > My code is this: > > install.packages("igraph") > library(igraph) > myEdgeList <- as.matrix(read.csv("myEdgeList.csv", as.is=TRUE)) > G <- graph.edgelist(myEdgeList, directed=FALSE) > myThemes <- read.csv("myThemes.csv", as.is=TRUE) > rowNumberofMatchingCases <- which(myThemes$association %in% > c("rhetoric" > )) > authorsOfMatchingCases <- myThemes$author [rowNumberofMatchingCases] > H <- induced.subgraph (G, authorsOfMatchingCases) > lout <- layout.fruchterman.reingold(H) > plot.igraph(H, layout=lout, vertex.size=5, vertex.label.cex=.5) > > My guess is I have broken some fundamental rule of graphing, like one > of the names performs too many functions in the graph, or I have > "rhetoric" too many times in the is the second csv file... > > But I really think the better question is: if you were just fooling > around and trying to make a citation network from hand and by > scratch, > like I'm doing, what could you not do with the list? and does this > have something to do with transitivity? > > DrakeWith "davis" you try to refer to a vertex (node) not existing in your vertex list. This results in an error. Take a look on this, if I understood your problem correctly it is a similar issue: https://stackoverflow.com/questions/30201510/error-with-subgraph-in-igraph-package HTH, Kimmo
Drake Gossi
2019-May-05 20:13 UTC
[R] what would break a citation network? [Error in as.igraph.vs(graph, vids) : Invalid vertex names]
So, "davis" was on the original edge list. It's just that I didn't want to reproduce the whole thing, since it was like 75 rows long, and I didn't want the email to get too cumbersome. In fact, that's partly why I was so confused, since that name was on both lists. But, even stranger, I ran the code today again as an experiment, and it worked just fine. Why would it work one day and not another? I should say that I'm at a university, too, and that therefore I'm on a public computer. Thank you for the link as well. D On Sat, May 4, 2019 at 10:35 PM K. Elo <maillists at pp.inet.fi> wrote:> > Hi Drake, > > 2019-05-04, 17:34 -0700, Drake Gossi wrote: > > Hello everyone, > > > > I'm trying to learn how to put together a citation network, and, in > > doing so, I'm playing around with a data set of my own making. I'm > > going back and forth between two .csv files. One has two columns and > > is simply labeled "to" and "from": > > > > to from > > rickert heidegger > > rickert nietzsche > > rickert parmenides > > rickert diogenes > > rickert latour > > rickert haraway > > rickert barad > > rickert burke > > boyle mackenzie > > boyle flusser > > boyle kittler > > boyle massumi > > boyle mattern > > boyle rickert > > boyle berlant > > boyle ulmer > > boyle manovich > > boyle burke > > > > So, rickert and boyle are academics, and the people to the right are > > other scholars they cite. This one .csv file goes on for 75 rows like > > this. > > > > But I have another file too, which looks like this. The two columns > > are "author" and "association": > > > > author association > > latour STS > > burke rhetoric > > kittler media theory > > heidegger philosophy > > barthes philosophy > > mackenzie media theory > > massumi affect theory > > nietzsche philosophy > > flusser media theory > > rickert rhetoric > > spinuzzi tech comm > > boyle rhetoric > > gries rhetoric > > jeff rice rhetoric > > jenny rice rhetoric > > gunn rhetoric > > rivers rhetoric > > mol STS > > stengers STS > > barad STS > > braidotti posthumanism > > wolfe posthumanism > > haraway STS > > > > The trouble is, when I add the following (davis, rhetoric) onto the > > second list, the citation network breaks. > > > > ... > > ... > > braidotti posthumanism > > wolfe posthumanism > > haraway STS > > davis rhetoric > > > > My question is: why would the addition of a single row break the > > analysis? I am getting this error message: > > > > Error in as.igraph.vs(graph, vids) : Invalid vertex names > > > > My code is this: > > > > install.packages("igraph") > > library(igraph) > > myEdgeList <- as.matrix(read.csv("myEdgeList.csv", as.is=TRUE)) > > G <- graph.edgelist(myEdgeList, directed=FALSE) > > myThemes <- read.csv("myThemes.csv", as.is=TRUE) > > rowNumberofMatchingCases <- which(myThemes$association %in% > > c("rhetoric" > > )) > > authorsOfMatchingCases <- myThemes$author [rowNumberofMatchingCases] > > H <- induced.subgraph (G, authorsOfMatchingCases) > > lout <- layout.fruchterman.reingold(H) > > plot.igraph(H, layout=lout, vertex.size=5, vertex.label.cex=.5) > > > > My guess is I have broken some fundamental rule of graphing, like one > > of the names performs too many functions in the graph, or I have > > "rhetoric" too many times in the is the second csv file... > > > > But I really think the better question is: if you were just fooling > > around and trying to make a citation network from hand and by > > scratch, > > like I'm doing, what could you not do with the list? and does this > > have something to do with transitivity? > > > > Drake > > With "davis" you try to refer to a vertex (node) not existing in your > vertex list. This results in an error. > > Take a look on this, if I understood your problem correctly it is a > similar issue: > > > https://stackoverflow.com/questions/30201510/error-with-subgraph-in-igraph-package > > HTH, > Kimmo > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.