how to create concentric layout for bipartite graph
up vote
1
down vote
favorite
I have a bipartite graph like this where I want one attribute on the outer circle and other attribute either on the inner circle or simply within the outer circle.
According to this question Bioconductor can do something like that, but I don't know how customisable are the fonts etc. Any other methods to create concentric layout for bipartite graph?
r layout graph igraph bioconductor
add a comment |
up vote
1
down vote
favorite
I have a bipartite graph like this where I want one attribute on the outer circle and other attribute either on the inner circle or simply within the outer circle.
According to this question Bioconductor can do something like that, but I don't know how customisable are the fonts etc. Any other methods to create concentric layout for bipartite graph?
r layout graph igraph bioconductor
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have a bipartite graph like this where I want one attribute on the outer circle and other attribute either on the inner circle or simply within the outer circle.
According to this question Bioconductor can do something like that, but I don't know how customisable are the fonts etc. Any other methods to create concentric layout for bipartite graph?
r layout graph igraph bioconductor
I have a bipartite graph like this where I want one attribute on the outer circle and other attribute either on the inner circle or simply within the outer circle.
According to this question Bioconductor can do something like that, but I don't know how customisable are the fonts etc. Any other methods to create concentric layout for bipartite graph?
r layout graph igraph bioconductor
r layout graph igraph bioconductor
edited Nov 20 at 4:52
alistaire
31.3k43563
31.3k43563
asked Nov 20 at 4:36
santoku
96711529
96711529
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
igraph has a bipartite layout that tries to minimize edge crossings. You could run this layout, extract the coordinates, then wrap them around a circle.
I am not experienced enough with R to be able to afford the time to show you how this is done with the R interface. But I can show you what it would look like when you're done, using the Mathematica interface of igraph.
<< IGraphM`
IGraph/M 0.3.103 (November 13, 2018)
Evaluate IGDocumentation to get started.
Generate a sparse random bipartite graph, take its largest connected component, and run the layout. If the graph is not sparse, it won't be possible to avoid edges passing through the middle of the circle.
IGSeedRandom[4];
bg = IGGiantComponent@IGBipartiteGameGNM[100, 100, 220];
bg = IGLayoutBipartite[bg, "BipartitePartitions" -> IGBipartitePartitions[bg]]
Extract the coordinates, and wrap them around two circles.
pts = GraphEmbedding[bg]; (* get vertex coordinates *)
{m1, m2} = Max /@ Values@GroupBy[pts, First -> Last]; (* find max coordinate for both vertex groups *)
newPts = If[#1 == -1,
2 {Cos[#2/m1 2 Pi], Sin[#2/m1 2 Pi]},
3 {Cos[#2/m2 2 Pi], Sin[#2/m2 2 Pi]}
] & @@@ pts; (* wrap both groups around a circle *)
Graph[VertexList[bg], EdgeList[bg], VertexCoordinates -> newPts]
The above uses a circle radius ratio of 3:2. The bigger the radius ratio, the fewer edges cross the inner circle. Here's a plot with a ratio of 3:1.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386314%2fhow-to-create-concentric-layout-for-bipartite-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
igraph has a bipartite layout that tries to minimize edge crossings. You could run this layout, extract the coordinates, then wrap them around a circle.
I am not experienced enough with R to be able to afford the time to show you how this is done with the R interface. But I can show you what it would look like when you're done, using the Mathematica interface of igraph.
<< IGraphM`
IGraph/M 0.3.103 (November 13, 2018)
Evaluate IGDocumentation to get started.
Generate a sparse random bipartite graph, take its largest connected component, and run the layout. If the graph is not sparse, it won't be possible to avoid edges passing through the middle of the circle.
IGSeedRandom[4];
bg = IGGiantComponent@IGBipartiteGameGNM[100, 100, 220];
bg = IGLayoutBipartite[bg, "BipartitePartitions" -> IGBipartitePartitions[bg]]
Extract the coordinates, and wrap them around two circles.
pts = GraphEmbedding[bg]; (* get vertex coordinates *)
{m1, m2} = Max /@ Values@GroupBy[pts, First -> Last]; (* find max coordinate for both vertex groups *)
newPts = If[#1 == -1,
2 {Cos[#2/m1 2 Pi], Sin[#2/m1 2 Pi]},
3 {Cos[#2/m2 2 Pi], Sin[#2/m2 2 Pi]}
] & @@@ pts; (* wrap both groups around a circle *)
Graph[VertexList[bg], EdgeList[bg], VertexCoordinates -> newPts]
The above uses a circle radius ratio of 3:2. The bigger the radius ratio, the fewer edges cross the inner circle. Here's a plot with a ratio of 3:1.
add a comment |
up vote
0
down vote
igraph has a bipartite layout that tries to minimize edge crossings. You could run this layout, extract the coordinates, then wrap them around a circle.
I am not experienced enough with R to be able to afford the time to show you how this is done with the R interface. But I can show you what it would look like when you're done, using the Mathematica interface of igraph.
<< IGraphM`
IGraph/M 0.3.103 (November 13, 2018)
Evaluate IGDocumentation to get started.
Generate a sparse random bipartite graph, take its largest connected component, and run the layout. If the graph is not sparse, it won't be possible to avoid edges passing through the middle of the circle.
IGSeedRandom[4];
bg = IGGiantComponent@IGBipartiteGameGNM[100, 100, 220];
bg = IGLayoutBipartite[bg, "BipartitePartitions" -> IGBipartitePartitions[bg]]
Extract the coordinates, and wrap them around two circles.
pts = GraphEmbedding[bg]; (* get vertex coordinates *)
{m1, m2} = Max /@ Values@GroupBy[pts, First -> Last]; (* find max coordinate for both vertex groups *)
newPts = If[#1 == -1,
2 {Cos[#2/m1 2 Pi], Sin[#2/m1 2 Pi]},
3 {Cos[#2/m2 2 Pi], Sin[#2/m2 2 Pi]}
] & @@@ pts; (* wrap both groups around a circle *)
Graph[VertexList[bg], EdgeList[bg], VertexCoordinates -> newPts]
The above uses a circle radius ratio of 3:2. The bigger the radius ratio, the fewer edges cross the inner circle. Here's a plot with a ratio of 3:1.
add a comment |
up vote
0
down vote
up vote
0
down vote
igraph has a bipartite layout that tries to minimize edge crossings. You could run this layout, extract the coordinates, then wrap them around a circle.
I am not experienced enough with R to be able to afford the time to show you how this is done with the R interface. But I can show you what it would look like when you're done, using the Mathematica interface of igraph.
<< IGraphM`
IGraph/M 0.3.103 (November 13, 2018)
Evaluate IGDocumentation to get started.
Generate a sparse random bipartite graph, take its largest connected component, and run the layout. If the graph is not sparse, it won't be possible to avoid edges passing through the middle of the circle.
IGSeedRandom[4];
bg = IGGiantComponent@IGBipartiteGameGNM[100, 100, 220];
bg = IGLayoutBipartite[bg, "BipartitePartitions" -> IGBipartitePartitions[bg]]
Extract the coordinates, and wrap them around two circles.
pts = GraphEmbedding[bg]; (* get vertex coordinates *)
{m1, m2} = Max /@ Values@GroupBy[pts, First -> Last]; (* find max coordinate for both vertex groups *)
newPts = If[#1 == -1,
2 {Cos[#2/m1 2 Pi], Sin[#2/m1 2 Pi]},
3 {Cos[#2/m2 2 Pi], Sin[#2/m2 2 Pi]}
] & @@@ pts; (* wrap both groups around a circle *)
Graph[VertexList[bg], EdgeList[bg], VertexCoordinates -> newPts]
The above uses a circle radius ratio of 3:2. The bigger the radius ratio, the fewer edges cross the inner circle. Here's a plot with a ratio of 3:1.
igraph has a bipartite layout that tries to minimize edge crossings. You could run this layout, extract the coordinates, then wrap them around a circle.
I am not experienced enough with R to be able to afford the time to show you how this is done with the R interface. But I can show you what it would look like when you're done, using the Mathematica interface of igraph.
<< IGraphM`
IGraph/M 0.3.103 (November 13, 2018)
Evaluate IGDocumentation to get started.
Generate a sparse random bipartite graph, take its largest connected component, and run the layout. If the graph is not sparse, it won't be possible to avoid edges passing through the middle of the circle.
IGSeedRandom[4];
bg = IGGiantComponent@IGBipartiteGameGNM[100, 100, 220];
bg = IGLayoutBipartite[bg, "BipartitePartitions" -> IGBipartitePartitions[bg]]
Extract the coordinates, and wrap them around two circles.
pts = GraphEmbedding[bg]; (* get vertex coordinates *)
{m1, m2} = Max /@ Values@GroupBy[pts, First -> Last]; (* find max coordinate for both vertex groups *)
newPts = If[#1 == -1,
2 {Cos[#2/m1 2 Pi], Sin[#2/m1 2 Pi]},
3 {Cos[#2/m2 2 Pi], Sin[#2/m2 2 Pi]}
] & @@@ pts; (* wrap both groups around a circle *)
Graph[VertexList[bg], EdgeList[bg], VertexCoordinates -> newPts]
The above uses a circle radius ratio of 3:2. The bigger the radius ratio, the fewer edges cross the inner circle. Here's a plot with a ratio of 3:1.
edited Nov 20 at 16:19
answered Nov 20 at 16:13
Szabolcs
16k361143
16k361143
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53386314%2fhow-to-create-concentric-layout-for-bipartite-graph%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown