It should be very simple, but I am stuck in this operation. I am interested in extracting the block Edge Data: 23,502 x 3. And to indicate the names of the nodes. In short, I need to know the weight of each pair of nodes by their names.
Code:
# A tbl_graph: 11539 nodes and 23502 edges
#
# An undirected simple graph with 2493 components
#
# Node Data: 11,539 x 3 (active)
name neighbors groups
<chr> <dbl> <int>
1 CHANSATITPORN N 1 1540
2 POBKEEREE V 1 1540
3 SAINIS G 4 361
4 HARITOS G 4 361
5 KRIEMADIS T 4 361
6 PAPASOLOMOU I 3 361
# … with 11,533 more rows
#
# Edge Data: 23,502 x 3
from to weight
<int> <int> <dbl>
1 1 2 1
2 3 4 2
3 3 5 2
# … with 23,499 more rows
You can extract the edge information using
data.frame()
on just the edges. You can replace the example tidygraph object I've namedtg
with your tidygraph object name and the code below should work for you.But if you also want the names in there as well, here is some code to simply extract the node information as well and join in the data together.
Created on 2020-09-21 by the reprex package (v0.3.0)