Hi Tamas,
Thank you very much for your suggestion.
I tried make_line_graph according to your suggestion. And it works very well for small scale graph.
However, when the graph include millions of nodes, it becomes hard to create a complete line graph.
I tried very hard based on current functions in igraph package, considering sampling the motifs is slightly different than the usual random walk since it requires checking the motif type during the random walk, so it takes long to finish the whole process, mostly because the transition from edge to node or node to edge, as I listed in the former email. The random walk actually doesn't take long, however, those functions called to converting edge to node before checking the motif type really slows down the motif sampling process.
So I am thinking if I can delve into the C code (
https://github.com/igraph/igraph/blob/master/src/random_walk.c) and work based on the current random_walk function and create a revised version of that to sample the motifs with size 2.The proposed function will return two vectors with the type
igraph_vector_t.
Each vector stores one of the ends of the sampled edge. In that way, I
can first finish the sampling procedure with the sampled edges acquired
and without creating a complete motif graph. Then I can check the motif
type with the help of isomorphism_class by accessing the neighboring two
pair of nodes returned by the random_motif_sampling function.
I already come out a draft version of that, but I don't know how to test it. My plan is to fork the igraph package to my local computer through Github and then test it on my side so that it won't affect the original package in case I make some mistake. The problem I encounter now is: how to embed my code to the igraph package so that I can test the code.