If the networks are small enough, I would draw the lines separately in Inkscape.
Alternatively, make the common nodes distinct (for example by appending 1 to the names of nodes in graph 1 and 2 for nodes in graph 2) and form a graph with the union of the two graphs then add edges between the common nodes. Give these edges a distinct attribute that will allow the software to draw them differently from the others.
I understand you. When I plot the two graph objects (networks) in the same image, they are mixed. I want to separate the two graphs far apart (one is at left the other one is at right), then place edges connecting shared nodes between the two networks. Any solutions?
and/or you can manually rearrange the nodes and save the coordinates:
tkid <- tkplot(myGraph, layout = coordinates.matrix) # move the nodes manually in new window
coordinates.matrix <- tkplot.getcoords(tkid) # get new node coordinates
In your case, I would probably create a layout function for the union graph that applies contraints on the coordinates of the nodes depending on which of the two initial graphs they come from (e.g. nodes from graph 1 can only be in the left half of the drawing area and nodes from graph 2, only in the right half).
Hello Jean-Karim,
My network is large.
I understand you. When I plot the two graph objects (networks) in the same image, they are mixed. I want to separate the two graphs far apart (one is at left the other one is at right), then place edges connecting shared nodes between the two networks. Any solutions?
Regards
In R, using the igraph package, you can specify the coordinates of the nodes
You can use your own function to generate the layout coordinates:
and/or you can manually rearrange the nodes and save the coordinates:
In your case, I would probably create a layout function for the union graph that applies contraints on the coordinates of the nodes depending on which of the two initial graphs they come from (e.g. nodes from graph 1 can only be in the left half of the drawing area and nodes from graph 2, only in the right half).
Hello Jean-Karim,
Thank you very much. I got the solution.
Regards.