igraph-help
[Top][All Lists]
Advanced

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

[igraph] combine edgelist and nodelist (error with vertices)


From: Stefan Wallaschek
Subject: [igraph] combine edgelist and nodelist (error with vertices)
Date: Sun, 25 Jun 2017 13:22:38 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

Dear all,

I have a question on combining two csv.files - one is a edgelist and the
other a nodelist. I want to combine them (graph.data.frame) and it
should be a directed graph. I am using R version 3.2.3/RStudio version
0.99.879 and igraph version 1.0.1.

The data looks like this:
head(nodes)
              Authors            Institution      status    gender
1 Jan Christoph Suntrup Käte Hamburger Kolleg     Post Doc      M
2      Renate Martinsen     Uni Duisburg-Essen        Prof      F
3          Bernd Ladwig              FU Berlin        Prof      M
4   Kathrin Morgenstern         Uni Regensburg PhD student      F
5         Barbara Weber         Uni Regensburg        Prof      F

Head(links)
  From.Author1          To.Author2       relation text.type no
1 Kathrin Morgenstern       Barbara Weber undirect    Review  1
2       Barbara Weber Kathrin Morgenstern undirect    Review  2
3       Andreas Busen       Paul Sörensen undirect     other  3
4       Andreas Busen         Lisa Herzog   direct     other  4
5      Matthias Lemke    Gregor Wiedemann undirect     other  5

As you can see, there are actors who have a mutual tie, some actors have
a directed tie to another actor and there are also isolated nodes.

By combining the edgelist and nodelist with graph.data.frame
g1 <- graph.data.frame(d=links, vertices = nodes, directed = T)
I get the error:
Error in graph.data.frame(links, vertices = nodes, directed = T) : Some
vertex names in edge list are not listed in vertex data frame

I checked for missing authors and I am now pretty sure that every actor
from the nodelist is at least listed once in the edgelist. I also
created loops for the isolated authors in the edgelist in case igraph
cannot treat 'NA' in 'To.Author2' (and I would later use simplify to
remove.loops). But these ideas have not solved the error.

I checked for answers and found here a suggestion:
https://stackoverflow.com/questions/42788914/r-igraph-graph-data-frame-error-some-vertex-names-in-edge-list-are-not-listed
in which the answer relates to this
https://stackoverflow.com/questions/42673949/creating-igraph-with-isolated-nodes/42675086#42675086


By following the instruction, the produced graph object takes the edge
attribute but doesn't include the node attributes.

So, how can I solve this error respectively what am I doing wrong?

Looking forward to your suggestions and advices!
Any help is appreciated!

All the best,
  Stefan

-- 
Stefan Wallaschek
Visting PhD fellow at School of Politics and International Relations (SPIRe)
University College Dublin
--
address@hidden
PhD Fellow
Bremen International Graduate School of Social Sciences (BIGSSS)/
University of Bremen
Mary-Somerville-Straße 9
P.O. Box 33 04 40
28359 Bremen (Germany)
https://www.bigsss-bremen.de/people/phd-fellows/stefan-wallaschek
Twitter: https://twitter.com/s_wallaschek



reply via email to

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