问题
I Would like to save a igraph graph
or a dataframe
to pajek
format.
So I have used the igraph
package to create graph object
and then used this write.graph(graph_activitynetwork,"layer_share","pajek")
to write the igraph graph
in pajek
.but what I am wondering is to create it in customized format :like this :
*Vertices 4
1 "Node 1"
2 "Node 2"
3 "Node 3"
4 "Node 4"
*Multiplex
# layer node layer node [weight]
1 1 1 2 2
1 1 2 2 1
1 2 1 1 1
now I could just have this format :
*Vertices 4
1 "1"
2 "2"
3 "3"
4 "4"
*Edges
# node node weight
1 2 l
1 3 l
1 4 l
Ps: My own data is in csv
and Excel
format.
node1 node2 weight layer
the graph summary :
IGRAPH UNW- --
+ attr: id (v/c), weight (e/c), layer1 (e/c),layer2 (e/c)
来源:https://stackoverflow.com/questions/28818695/how-to-write-a-dataframe-graph-to-pajek-format